@orderly.network/ui-orders 2.8.10 → 2.8.11-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.mjs CHANGED
@@ -148,10 +148,8 @@ function calcBracketRoiAndPnL(order) {
148
148
  // },
149
149
  };
150
150
  const { tpOrder, slOrder } = findBracketTPSLOrder(order);
151
- if (!tpOrder && !slOrder)
152
- return defaultCallback;
153
- if (typeof order.price === void 0 || !order.price)
154
- return defaultCallback;
151
+ if (!tpOrder && !slOrder) return defaultCallback;
152
+ if (typeof order.price === void 0 || !order.price) return defaultCallback;
155
153
  const quantity2 = order.side === OrderSide.BUY ? order.quantity : order.quantity * -1;
156
154
  const tpPnL = tpOrder?.trigger_price && utils.priceToPnl({
157
155
  qty: quantity2,
@@ -185,8 +183,7 @@ function calcBracketRoiAndPnL(order) {
185
183
  };
186
184
  }
187
185
  function areDatesEqual(date1, date2) {
188
- if (!date1 || !date2)
189
- return false;
186
+ if (!date1 || !date2) return false;
190
187
  return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
191
188
  }
192
189
  function isTrailingStopOrder(order) {
@@ -212,12 +209,9 @@ var upperCaseFirstLetter;
212
209
  var init_util = __esm({
213
210
  "src/utils/util.ts"() {
214
211
  upperCaseFirstLetter = (str) => {
215
- if (str === void 0)
216
- return str;
217
- if (str.length === 0)
218
- return str;
219
- if (str.length === 1)
220
- return str.charAt(0).toUpperCase();
212
+ if (str === void 0) return str;
213
+ if (str.length === 0) return str;
214
+ if (str.length === 1) return str.charAt(0).toUpperCase();
221
215
  return str.charAt(0).toUpperCase() + str.toLowerCase().slice(1);
222
216
  };
223
217
  }
@@ -485,8 +479,7 @@ var init_cancelBtn = __esm({
485
479
  variant: "outlined",
486
480
  color: "secondary",
487
481
  onClick: (event) => {
488
- if (!onCancelOrder)
489
- return;
482
+ if (!onCancelOrder) return;
490
483
  event.preventDefault();
491
484
  event.stopPropagation();
492
485
  setIsLoading(true);
@@ -1589,8 +1582,7 @@ var init_quantityCell = __esm({
1589
1582
  setValue: (e) => {
1590
1583
  const quantity3 = Math.abs(Math.min(Number(e), maxQty)).toString();
1591
1584
  setQuantity(e, maxQty);
1592
- if (e.endsWith("."))
1593
- return;
1585
+ if (e.endsWith(".")) return;
1594
1586
  if (Number(quantity3) === 0) {
1595
1587
  setSliderValue(0);
1596
1588
  return;
@@ -2017,8 +2009,7 @@ var init_renew = __esm({
2017
2009
  loading: isMutating,
2018
2010
  disabled: isMutating,
2019
2011
  onClick: (event) => {
2020
- if (isMutating)
2021
- return;
2012
+ if (isMutating) return;
2022
2013
  event.preventDefault();
2023
2014
  event.stopPropagation();
2024
2015
  onSubmit();
@@ -2155,8 +2146,7 @@ var init_tpslTriggerPrice = __esm({
2155
2146
  const { t } = useTranslation();
2156
2147
  const pnl = useMemo(() => {
2157
2148
  const msgs = [];
2158
- if (!props.tooltip || !order || !position)
2159
- return;
2149
+ if (!props.tooltip || !order || !position) return;
2160
2150
  let quantity2 = order.quantity;
2161
2151
  if (quantity2 === 0) {
2162
2152
  if (order.child_orders?.[0].type === "CLOSE_POSITION") {
@@ -2206,8 +2196,7 @@ var init_tpslTriggerPrice = __esm({
2206
2196
  ]);
2207
2197
  const child = useMemo(() => {
2208
2198
  const children = [];
2209
- if (!order?.symbol)
2210
- return /* @__PURE__ */ jsx("span", { children: "-" });
2199
+ if (!order?.symbol) return /* @__PURE__ */ jsx("span", { children: "-" });
2211
2200
  if (props.takeProfitPrice) {
2212
2201
  children.push(
2213
2202
  /* @__PURE__ */ jsx(
@@ -2257,8 +2246,7 @@ var init_tpslTriggerPrice = __esm({
2257
2246
  )
2258
2247
  );
2259
2248
  }
2260
- if (children.length === 0)
2261
- return /* @__PURE__ */ jsx("span", { children: "-" });
2249
+ if (children.length === 0) return /* @__PURE__ */ jsx("span", { children: "-" });
2262
2250
  if (children.length === 2 && direction === "row") {
2263
2251
  children.splice(1, 0, /* @__PURE__ */ jsx("span", { children: "/" }, "split"));
2264
2252
  }
@@ -2854,10 +2842,8 @@ function tpslAction(option) {
2854
2842
  };
2855
2843
  }
2856
2844
  function compareNumbers(a, b) {
2857
- if (a > b)
2858
- return 1;
2859
- if (a < b)
2860
- return -1;
2845
+ if (a > b) return 1;
2846
+ if (a < b) return -1;
2861
2847
  return 0;
2862
2848
  }
2863
2849
  function estTotalValue(record, isPending) {
@@ -3675,8 +3661,7 @@ var init_items = __esm({
3675
3661
  MobileTooltip = (props) => {
3676
3662
  const { classNames, content } = props;
3677
3663
  const [open, setOpen] = useState(false);
3678
- if (typeof content === "undefined")
3679
- return props.children;
3664
+ if (typeof content === "undefined") return props.children;
3680
3665
  return /* @__PURE__ */ jsx(
3681
3666
  Tooltip,
3682
3667
  {
@@ -3766,8 +3751,7 @@ var init_bracketOrderPrice_ui = __esm({
3766
3751
  order: props.order
3767
3752
  });
3768
3753
  };
3769
- if (!props.sl_trigger_price && !props.tp_trigger_price)
3770
- return /* @__PURE__ */ jsx(Fragment, {});
3754
+ if (!props.sl_trigger_price && !props.tp_trigger_price) return /* @__PURE__ */ jsx(Fragment, {});
3771
3755
  return /* @__PURE__ */ jsxs(Flex, { gap: 1, itemAlign: "center", justify: "start", children: [
3772
3756
  /* @__PURE__ */ jsx(
3773
3757
  MobileTooltip,
@@ -3945,8 +3929,7 @@ var init_cancelBtn_script = __esm({
3945
3929
  const { onCancelOrder } = useOrderListContext();
3946
3930
  const [isLoading, setIsLoading] = useState(false);
3947
3931
  const onCancel = (event) => {
3948
- if (!onCancelOrder)
3949
- return Promise.resolve();
3932
+ if (!onCancelOrder) return Promise.resolve();
3950
3933
  event?.preventDefault();
3951
3934
  event?.stopPropagation();
3952
3935
  setIsLoading(true);
@@ -5409,15 +5392,13 @@ var init_useFormatOrderHistory = __esm({
5409
5392
  }
5410
5393
  });
5411
5394
  function offsetStartOfDay(date) {
5412
- if (date == null)
5413
- return date;
5395
+ if (date == null) return date;
5414
5396
  const newDate = new Date(date);
5415
5397
  newDate.setHours(0, 0, 0, 0);
5416
5398
  return newDate;
5417
5399
  }
5418
5400
  function offsetEndOfDay(date) {
5419
- if (date == null)
5420
- return date;
5401
+ if (date == null) return date;
5421
5402
  const newDate = new Date(date);
5422
5403
  newDate.setHours(23, 59, 59, 999);
5423
5404
  return newDate;
@@ -5931,5 +5912,5 @@ init_orders_script();
5931
5912
  init_orderList();
5932
5913
 
5933
5914
  export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, OrdersWidget, TabType, useOrderListScript, useOrdersScript };
5934
- //# sourceMappingURL=out.js.map
5915
+ //# sourceMappingURL=index.mjs.map
5935
5916
  //# sourceMappingURL=index.mjs.map