@kodiak-finance/orderly-ui-orders 2.9.2 → 2.9.3
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 +53 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React2, { forwardRef, useMemo, useEffect, useRef, useCallback, useImperativeHandle, useState, createContext, memo, useContext } from 'react';
|
|
2
|
-
import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useConfig, useTpslPriceChecker, useOrderEntity, useReferralInfo,
|
|
2
|
+
import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useBadgeBySymbol, useConfig, useTpslPriceChecker, useOrderEntity, useReferralInfo, useLeverageBySymbol } from '@kodiak-finance/orderly-hooks';
|
|
3
3
|
import { useTranslation, Trans, i18n } from '@kodiak-finance/orderly-i18n';
|
|
4
4
|
import { OrderStatus, AlgoOrderRootType, MarginMode, AlgoOrderType, OrderSide, OrderType, EMPTY_LIST } from '@kodiak-finance/orderly-types';
|
|
5
5
|
import { Decimal, commify, commifyOptional, formatSymbol, getTrailingStopPrice, formatNum } from '@kodiak-finance/orderly-utils';
|
|
@@ -586,7 +586,7 @@ var init_confirmContent = __esm({
|
|
|
586
586
|
/* @__PURE__ */ jsx(
|
|
587
587
|
"button",
|
|
588
588
|
{
|
|
589
|
-
className: "oui-absolute oui-
|
|
589
|
+
className: "oui-absolute oui-end-0 oui-top-0 oui-text-base-contrast-54",
|
|
590
590
|
onClick: cancelPopover,
|
|
591
591
|
children: /* @__PURE__ */ jsx(CloseIcon, { size: 16, color: "white", opacity: 1 })
|
|
592
592
|
}
|
|
@@ -734,7 +734,7 @@ var init_editableCellInput = __esm({
|
|
|
734
734
|
],
|
|
735
735
|
classNames: {
|
|
736
736
|
root: "oui-bg-base-700 oui-px-2 oui-py-1 oui-rounded",
|
|
737
|
-
input: "oui-
|
|
737
|
+
input: "oui-pe-2"
|
|
738
738
|
},
|
|
739
739
|
readOnly: props.readonly,
|
|
740
740
|
suffix: /* @__PURE__ */ jsxs(Flex, { gapX: 1, children: [
|
|
@@ -1278,7 +1278,7 @@ var init_innerInput = __esm({
|
|
|
1278
1278
|
color: open ? "danger" : void 0,
|
|
1279
1279
|
classNames: {
|
|
1280
1280
|
root: "oui-bg-base-700 oui-px-2 oui-py-1 oui-rounded",
|
|
1281
|
-
input: "oui-
|
|
1281
|
+
input: "oui-pe-2"
|
|
1282
1282
|
},
|
|
1283
1283
|
suffix: /* @__PURE__ */ jsx("button", { onClick, children: /* @__PURE__ */ jsx(
|
|
1284
1284
|
CheckIcon,
|
|
@@ -2008,6 +2008,29 @@ var init_triggerPriceCell = __esm({
|
|
|
2008
2008
|
};
|
|
2009
2009
|
}
|
|
2010
2010
|
});
|
|
2011
|
+
var OrderSymbolCell;
|
|
2012
|
+
var init_orderSymbolCell = __esm({
|
|
2013
|
+
"src/components/orderList/desktop/orderSymbolCell.tsx"() {
|
|
2014
|
+
OrderSymbolCell = (props) => {
|
|
2015
|
+
const { symbol, onSymbolChange } = props;
|
|
2016
|
+
const { brokerId, brokerName, brokerNameRaw } = useBadgeBySymbol(symbol);
|
|
2017
|
+
return /* @__PURE__ */ jsx(
|
|
2018
|
+
Text.symbolBadge,
|
|
2019
|
+
{
|
|
2020
|
+
className: "oui-cursor-pointer",
|
|
2021
|
+
badge: brokerName ?? brokerId ?? void 0,
|
|
2022
|
+
fullName: brokerNameRaw,
|
|
2023
|
+
onClick: (e) => {
|
|
2024
|
+
onSymbolChange?.({ symbol });
|
|
2025
|
+
e.stopPropagation();
|
|
2026
|
+
e.preventDefault();
|
|
2027
|
+
},
|
|
2028
|
+
children: symbol
|
|
2029
|
+
}
|
|
2030
|
+
);
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2011
2034
|
var Renew;
|
|
2012
2035
|
var init_renew = __esm({
|
|
2013
2036
|
"src/components/orderList/desktop/renew.tsx"() {
|
|
@@ -2280,7 +2303,7 @@ var init_tpslTriggerPrice = __esm({
|
|
|
2280
2303
|
CloseToLiqPriceIcon,
|
|
2281
2304
|
{
|
|
2282
2305
|
slPriceError: props.slPriceError,
|
|
2283
|
-
className: "oui-
|
|
2306
|
+
className: "oui-ms-1"
|
|
2284
2307
|
}
|
|
2285
2308
|
)
|
|
2286
2309
|
},
|
|
@@ -2342,7 +2365,7 @@ var init_tpslTriggerPrice = __esm({
|
|
|
2342
2365
|
const type = orderType === AlgoOrderType.TAKE_PROFIT ? "TP" : "SL";
|
|
2343
2366
|
const label = type === "TP" ? `${t("tpsl.tpPnl")}:` : `${t("tpsl.slPnl")}:`;
|
|
2344
2367
|
return /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-items-center", children: [
|
|
2345
|
-
/* @__PURE__ */ jsx("span", { className: "oui-text-base-contrast-54 oui-
|
|
2368
|
+
/* @__PURE__ */ jsx("span", { className: "oui-text-base-contrast-54 oui-me-1", children: label }),
|
|
2346
2369
|
/* @__PURE__ */ jsx(
|
|
2347
2370
|
Text.numeral,
|
|
2348
2371
|
{
|
|
@@ -2354,7 +2377,7 @@ var init_tpslTriggerPrice = __esm({
|
|
|
2354
2377
|
// @ts-ignore
|
|
2355
2378
|
/* @__PURE__ */ jsx("span", { children: pnl === 0 ? "" : pnl > 0 ? "+" : "-" })
|
|
2356
2379
|
),
|
|
2357
|
-
suffix: /* @__PURE__ */ jsx("span", { className: "oui-text-base-contrast-36 oui-
|
|
2380
|
+
suffix: /* @__PURE__ */ jsx("span", { className: "oui-text-base-contrast-36 oui-ms-1", children: "USDC" }),
|
|
2358
2381
|
children: `${Math.abs(pnl)}`
|
|
2359
2382
|
}
|
|
2360
2383
|
)
|
|
@@ -2366,7 +2389,7 @@ function instrument(option) {
|
|
|
2366
2389
|
return {
|
|
2367
2390
|
title: i18n.t("common.symbol"),
|
|
2368
2391
|
dataIndex: "symbol",
|
|
2369
|
-
fixed: "
|
|
2392
|
+
fixed: "start",
|
|
2370
2393
|
// className: "oui-h-[48px]",
|
|
2371
2394
|
width: option?.width,
|
|
2372
2395
|
onSort: option?.enableSort ? (r1, r2) => {
|
|
@@ -2384,23 +2407,17 @@ function instrument(option) {
|
|
|
2384
2407
|
"div",
|
|
2385
2408
|
{
|
|
2386
2409
|
className: cn(
|
|
2387
|
-
"oui-h-
|
|
2410
|
+
"oui-h-[34px] oui-w-1 oui-shrink-0 oui-rounded-[1px]",
|
|
2388
2411
|
record.side === OrderSide.BUY ? "oui-bg-trade-profit" : "oui-bg-trade-loss"
|
|
2389
2412
|
)
|
|
2390
2413
|
}
|
|
2391
2414
|
),
|
|
2392
2415
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
2393
2416
|
/* @__PURE__ */ jsx(
|
|
2394
|
-
|
|
2417
|
+
OrderSymbolCell,
|
|
2395
2418
|
{
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
onClick: (e) => {
|
|
2399
|
-
option?.onSymbolChange?.({ symbol: value });
|
|
2400
|
-
e.stopPropagation();
|
|
2401
|
-
e.preventDefault();
|
|
2402
|
-
},
|
|
2403
|
-
children: `${value.split("_")[1]}-PERP`
|
|
2419
|
+
symbol: value,
|
|
2420
|
+
onSymbolChange: option?.onSymbolChange
|
|
2404
2421
|
}
|
|
2405
2422
|
),
|
|
2406
2423
|
option?.showType && /* @__PURE__ */ jsx(Flex, { direction: "row", gap: 1, wrap: "wrap", children: parseBadgesFor(record)?.map((e, index) => /* @__PURE__ */ jsx(
|
|
@@ -2678,10 +2695,9 @@ function realizedPnL(option) {
|
|
|
2678
2695
|
const value = new Decimal(_value ?? 0).toNumber();
|
|
2679
2696
|
return /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
2680
2697
|
/* @__PURE__ */ jsx(
|
|
2681
|
-
Text.
|
|
2698
|
+
Text.pnl,
|
|
2682
2699
|
{
|
|
2683
2700
|
dp,
|
|
2684
|
-
rm: Decimal.ROUND_DOWN,
|
|
2685
2701
|
padding: false,
|
|
2686
2702
|
intensity: (value ?? 0) == 0 ? 80 : void 0,
|
|
2687
2703
|
showIdentifier: (value ?? 0) > 0,
|
|
@@ -2841,7 +2857,7 @@ function cancelBtn(option) {
|
|
|
2841
2857
|
width: option?.width,
|
|
2842
2858
|
className: option?.className,
|
|
2843
2859
|
align: "right",
|
|
2844
|
-
fixed: "
|
|
2860
|
+
fixed: "end",
|
|
2845
2861
|
render: (_, record) => {
|
|
2846
2862
|
if (record.status === OrderStatus.CANCELLED) {
|
|
2847
2863
|
return /* @__PURE__ */ jsx(Renew, { record });
|
|
@@ -2861,7 +2877,7 @@ function pendingTabCancelBtn(option) {
|
|
|
2861
2877
|
width: option?.width,
|
|
2862
2878
|
className: option?.className,
|
|
2863
2879
|
align: "right",
|
|
2864
|
-
fixed: "
|
|
2880
|
+
fixed: "end",
|
|
2865
2881
|
render: (_, record) => {
|
|
2866
2882
|
return /* @__PURE__ */ jsx(CancelButton, { order: record });
|
|
2867
2883
|
}
|
|
@@ -2875,7 +2891,7 @@ function tpslAction(option) {
|
|
|
2875
2891
|
width: option?.width,
|
|
2876
2892
|
className: option?.className,
|
|
2877
2893
|
align: "right",
|
|
2878
|
-
fixed: "
|
|
2894
|
+
fixed: "end",
|
|
2879
2895
|
render: (_, record) => {
|
|
2880
2896
|
return /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
|
|
2881
2897
|
/* @__PURE__ */ jsx(TP_SLEditButton, { order: record }),
|
|
@@ -2932,6 +2948,7 @@ var init_useColumn = __esm({
|
|
|
2932
2948
|
init_quantityCell();
|
|
2933
2949
|
init_trailingCallbackCell();
|
|
2934
2950
|
init_triggerPriceCell();
|
|
2951
|
+
init_orderSymbolCell();
|
|
2935
2952
|
init_renew();
|
|
2936
2953
|
init_tpslEdit();
|
|
2937
2954
|
init_tpslPrice();
|
|
@@ -2959,7 +2976,7 @@ var init_useColumn = __esm({
|
|
|
2959
2976
|
fillAndQuantity({
|
|
2960
2977
|
width: 130,
|
|
2961
2978
|
disableEdit: true,
|
|
2962
|
-
className: "oui-
|
|
2979
|
+
className: "oui-ps-0 oui-pe-0",
|
|
2963
2980
|
enableSort: false
|
|
2964
2981
|
}),
|
|
2965
2982
|
price({
|
|
@@ -2996,12 +3013,12 @@ var init_useColumn = __esm({
|
|
|
2996
3013
|
// side({ width: 162 }),
|
|
2997
3014
|
fillAndQuantity({
|
|
2998
3015
|
width: 162,
|
|
2999
|
-
className: "oui-
|
|
3016
|
+
className: "oui-pe-0",
|
|
3000
3017
|
enableSort: false
|
|
3001
3018
|
}),
|
|
3002
|
-
price({ width: 162, className: "oui-
|
|
3019
|
+
price({ width: 162, className: "oui-pe-0", enableSort: false }),
|
|
3003
3020
|
trailingCallback({ width: 162 }),
|
|
3004
|
-
triggerPrice({ width: 162, className: "oui-
|
|
3021
|
+
triggerPrice({ width: 162, className: "oui-pe-0", isPending: true }),
|
|
3005
3022
|
bracketOrderPrice({ width: 130 }),
|
|
3006
3023
|
estTotal({ width: 162, isPending: true }),
|
|
3007
3024
|
reduceOnly({ width: 162 }),
|
|
@@ -3038,7 +3055,7 @@ var init_useColumn = __esm({
|
|
|
3038
3055
|
fillAndQuantity({
|
|
3039
3056
|
width: 124,
|
|
3040
3057
|
disableEdit: true,
|
|
3041
|
-
className: "oui-
|
|
3058
|
+
className: "oui-ps-0 oui-pe-0"
|
|
3042
3059
|
}),
|
|
3043
3060
|
price({
|
|
3044
3061
|
width: 124,
|
|
@@ -3073,7 +3090,7 @@ var init_useColumn = __esm({
|
|
|
3073
3090
|
fillAndQuantity({
|
|
3074
3091
|
width: 124,
|
|
3075
3092
|
disableEdit: true,
|
|
3076
|
-
className: "oui-
|
|
3093
|
+
className: "oui-ps-0 oui-pe-0",
|
|
3077
3094
|
enableSort: false
|
|
3078
3095
|
}),
|
|
3079
3096
|
price({ width: 124, disableEdit: true, enableSort: false }),
|
|
@@ -3096,7 +3113,7 @@ var init_useColumn = __esm({
|
|
|
3096
3113
|
fillAndQuantity({
|
|
3097
3114
|
width: 124,
|
|
3098
3115
|
disableEdit: true,
|
|
3099
|
-
className: "oui-
|
|
3116
|
+
className: "oui-ps-0 oui-pe-0"
|
|
3100
3117
|
}),
|
|
3101
3118
|
price({ width: 124, disableEdit: true }),
|
|
3102
3119
|
avgOpen({ width: 124 }),
|
|
@@ -3119,7 +3136,7 @@ var init_useColumn = __esm({
|
|
|
3119
3136
|
fillAndQuantity({
|
|
3120
3137
|
width: 150,
|
|
3121
3138
|
disableEdit: true,
|
|
3122
|
-
className: "oui-
|
|
3139
|
+
className: "oui-ps-6 oui-pe-0"
|
|
3123
3140
|
}),
|
|
3124
3141
|
price({
|
|
3125
3142
|
width: 124,
|
|
@@ -3459,7 +3476,7 @@ var init_items = __esm({
|
|
|
3459
3476
|
}
|
|
3460
3477
|
),
|
|
3461
3478
|
classNames: {
|
|
3462
|
-
content: "oui-bg-base-6 oui-
|
|
3479
|
+
content: "oui-bg-base-6 oui-ms-2",
|
|
3463
3480
|
arrow: "oui-fill-base-6"
|
|
3464
3481
|
},
|
|
3465
3482
|
children: /* @__PURE__ */ jsx(
|
|
@@ -3512,7 +3529,7 @@ var init_items = __esm({
|
|
|
3512
3529
|
}
|
|
3513
3530
|
),
|
|
3514
3531
|
classNames: {
|
|
3515
|
-
content: "oui-bg-base-6 oui-
|
|
3532
|
+
content: "oui-bg-base-6 oui-ms-2",
|
|
3516
3533
|
arrow: "oui-fill-base-6"
|
|
3517
3534
|
},
|
|
3518
3535
|
children: /* @__PURE__ */ jsx(
|
|
@@ -3556,7 +3573,7 @@ var init_items = __esm({
|
|
|
3556
3573
|
children: tp_order_price
|
|
3557
3574
|
}
|
|
3558
3575
|
);
|
|
3559
|
-
}, [tp_order_price]);
|
|
3576
|
+
}, [props.quote_dp, t, tp_order_price]);
|
|
3560
3577
|
return /* @__PURE__ */ jsx(
|
|
3561
3578
|
Statistic,
|
|
3562
3579
|
{
|
|
@@ -3589,7 +3606,7 @@ var init_items = __esm({
|
|
|
3589
3606
|
children: sl_order_price
|
|
3590
3607
|
}
|
|
3591
3608
|
);
|
|
3592
|
-
}, [sl_order_price]);
|
|
3609
|
+
}, [props.quote_dp, sl_order_price, t]);
|
|
3593
3610
|
return /* @__PURE__ */ jsx(
|
|
3594
3611
|
Statistic,
|
|
3595
3612
|
{
|
|
@@ -3814,7 +3831,7 @@ var init_bracketOrderPrice_ui = __esm({
|
|
|
3814
3831
|
MobileTooltip,
|
|
3815
3832
|
{
|
|
3816
3833
|
classNames: {
|
|
3817
|
-
content: "oui-bg-base-6 oui-
|
|
3834
|
+
content: "oui-bg-base-6 oui-ms-2",
|
|
3818
3835
|
arrow: "oui-fill-base-6"
|
|
3819
3836
|
},
|
|
3820
3837
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
|
|
@@ -5054,7 +5071,7 @@ var init_editBtn_script = __esm({
|
|
|
5054
5071
|
}).catch((error) => {
|
|
5055
5072
|
});
|
|
5056
5073
|
}
|
|
5057
|
-
}, [state]);
|
|
5074
|
+
}, [editAlgoOrder, editOrder, position, state, symbolInfo, t]);
|
|
5058
5075
|
return {
|
|
5059
5076
|
...state,
|
|
5060
5077
|
onShowEditSheet
|