@orderly.network/ui-tpsl 2.9.1 → 2.10.0-alpha.1
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 +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -302,12 +302,16 @@ var usePNLInputBuilder = (props) => {
|
|
|
302
302
|
value2 = `${value2}`;
|
|
303
303
|
if (value2 === "" || value2 === "-") return "";
|
|
304
304
|
if (mode === "Offset%" /* PERCENTAGE */) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
305
|
+
try {
|
|
306
|
+
return `${new utils.Decimal(
|
|
307
|
+
value2.replace(
|
|
308
|
+
new RegExp(percentageSuffix.current.replace(".", "\\.") + "$"),
|
|
309
|
+
""
|
|
310
|
+
)
|
|
311
|
+
).mul(100).todp(2, 4).toString()}${percentageSuffix.current}`;
|
|
312
|
+
} catch {
|
|
313
|
+
return "";
|
|
314
|
+
}
|
|
311
315
|
} else if (mode === "Offset" /* OFFSET */) {
|
|
312
316
|
value2 = utils.todpIfNeed(value2, dp);
|
|
313
317
|
} else ;
|
|
@@ -326,7 +330,11 @@ var usePNLInputBuilder = (props) => {
|
|
|
326
330
|
} else {
|
|
327
331
|
percentageSuffix.current = "";
|
|
328
332
|
}
|
|
329
|
-
|
|
333
|
+
try {
|
|
334
|
+
value2 = new utils.Decimal(value2).div(100).toString();
|
|
335
|
+
} catch {
|
|
336
|
+
value2 = "";
|
|
337
|
+
}
|
|
330
338
|
value2 = `${value2}${percentageSuffix.current}`;
|
|
331
339
|
}
|
|
332
340
|
} else if (mode === "PnL" /* PnL */ && type === "SL" && focus) {
|