@orderly.network/ui-tpsl 3.1.2 → 3.1.3-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 +18 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -1391,6 +1391,7 @@ var useTPSLBuilder = (options) => {
|
|
|
1391
1391
|
symbol,
|
|
1392
1392
|
position?.margin_mode ?? options.position?.margin_mode ?? MarginMode.CROSS
|
|
1393
1393
|
);
|
|
1394
|
+
const effectivePositionType = triggerPrice ? PositionType.PARTIAL : positionType;
|
|
1394
1395
|
useEffect(() => {
|
|
1395
1396
|
if (!position) {
|
|
1396
1397
|
options.close?.();
|
|
@@ -1419,7 +1420,7 @@ var useTPSLBuilder = (options) => {
|
|
|
1419
1420
|
},
|
|
1420
1421
|
{
|
|
1421
1422
|
defaultOrder: order2,
|
|
1422
|
-
positionType:
|
|
1423
|
+
positionType: effectivePositionType,
|
|
1423
1424
|
// tpslEnable: {
|
|
1424
1425
|
// tp_enable: !withTriggerPrice ? true : type === "tp",
|
|
1425
1426
|
// sl_enable: !withTriggerPrice ? true : type === "sl",
|
|
@@ -1446,6 +1447,21 @@ var useTPSLBuilder = (options) => {
|
|
|
1446
1447
|
() => Math.abs(Number(position?.position_qty)),
|
|
1447
1448
|
[position?.position_qty]
|
|
1448
1449
|
);
|
|
1450
|
+
useEffect(() => {
|
|
1451
|
+
if (!position || !Number.isFinite(maxQty)) {
|
|
1452
|
+
return;
|
|
1453
|
+
}
|
|
1454
|
+
const quantity = Number(tpslOrder.quantity);
|
|
1455
|
+
if (effectivePositionType === PositionType.FULL) {
|
|
1456
|
+
if (quantity !== maxQty) {
|
|
1457
|
+
setValue("quantity", maxQty);
|
|
1458
|
+
}
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1461
|
+
if (quantity > maxQty) {
|
|
1462
|
+
setValue("quantity", maxQty);
|
|
1463
|
+
}
|
|
1464
|
+
}, [effectivePositionType, maxQty, position, setValue, tpslOrder.quantity]);
|
|
1449
1465
|
useMemo(() => {
|
|
1450
1466
|
const quantity = order2?.algo_type === AlgoOrderRootType.POSITIONAL_TP_SL ? maxQty : order2?.quantity;
|
|
1451
1467
|
let diff = 0;
|
|
@@ -1556,7 +1572,7 @@ var useTPSLBuilder = (options) => {
|
|
|
1556
1572
|
content: /* @__PURE__ */ jsx(
|
|
1557
1573
|
PositionTPSLConfirm,
|
|
1558
1574
|
{
|
|
1559
|
-
isPositionTPSL:
|
|
1575
|
+
isPositionTPSL: effectivePositionType === PositionType.FULL,
|
|
1560
1576
|
isEditing,
|
|
1561
1577
|
symbol: order3.symbol,
|
|
1562
1578
|
qty: Number(order3.quantity),
|