@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.js CHANGED
@@ -154,10 +154,8 @@ function calcBracketRoiAndPnL(order) {
154
154
  // },
155
155
  };
156
156
  const { tpOrder, slOrder } = findBracketTPSLOrder(order);
157
- if (!tpOrder && !slOrder)
158
- return defaultCallback;
159
- if (typeof order.price === void 0 || !order.price)
160
- return defaultCallback;
157
+ if (!tpOrder && !slOrder) return defaultCallback;
158
+ if (typeof order.price === void 0 || !order.price) return defaultCallback;
161
159
  const quantity2 = order.side === types.OrderSide.BUY ? order.quantity : order.quantity * -1;
162
160
  const tpPnL = tpOrder?.trigger_price && hooks.utils.priceToPnl({
163
161
  qty: quantity2,
@@ -191,8 +189,7 @@ function calcBracketRoiAndPnL(order) {
191
189
  };
192
190
  }
193
191
  function areDatesEqual(date1, date2) {
194
- if (!date1 || !date2)
195
- return false;
192
+ if (!date1 || !date2) return false;
196
193
  return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
197
194
  }
198
195
  function isTrailingStopOrder(order) {
@@ -218,12 +215,9 @@ var upperCaseFirstLetter;
218
215
  var init_util = __esm({
219
216
  "src/utils/util.ts"() {
220
217
  upperCaseFirstLetter = (str) => {
221
- if (str === void 0)
222
- return str;
223
- if (str.length === 0)
224
- return str;
225
- if (str.length === 1)
226
- return str.charAt(0).toUpperCase();
218
+ if (str === void 0) return str;
219
+ if (str.length === 0) return str;
220
+ if (str.length === 1) return str.charAt(0).toUpperCase();
227
221
  return str.charAt(0).toUpperCase() + str.toLowerCase().slice(1);
228
222
  };
229
223
  }
@@ -491,8 +485,7 @@ var init_cancelBtn = __esm({
491
485
  variant: "outlined",
492
486
  color: "secondary",
493
487
  onClick: (event) => {
494
- if (!onCancelOrder)
495
- return;
488
+ if (!onCancelOrder) return;
496
489
  event.preventDefault();
497
490
  event.stopPropagation();
498
491
  setIsLoading(true);
@@ -1595,8 +1588,7 @@ var init_quantityCell = __esm({
1595
1588
  setValue: (e) => {
1596
1589
  const quantity3 = Math.abs(Math.min(Number(e), maxQty)).toString();
1597
1590
  setQuantity(e, maxQty);
1598
- if (e.endsWith("."))
1599
- return;
1591
+ if (e.endsWith(".")) return;
1600
1592
  if (Number(quantity3) === 0) {
1601
1593
  setSliderValue(0);
1602
1594
  return;
@@ -2023,8 +2015,7 @@ var init_renew = __esm({
2023
2015
  loading: isMutating,
2024
2016
  disabled: isMutating,
2025
2017
  onClick: (event) => {
2026
- if (isMutating)
2027
- return;
2018
+ if (isMutating) return;
2028
2019
  event.preventDefault();
2029
2020
  event.stopPropagation();
2030
2021
  onSubmit();
@@ -2161,8 +2152,7 @@ var init_tpslTriggerPrice = __esm({
2161
2152
  const { t } = i18n.useTranslation();
2162
2153
  const pnl = React2.useMemo(() => {
2163
2154
  const msgs = [];
2164
- if (!props.tooltip || !order || !position)
2165
- return;
2155
+ if (!props.tooltip || !order || !position) return;
2166
2156
  let quantity2 = order.quantity;
2167
2157
  if (quantity2 === 0) {
2168
2158
  if (order.child_orders?.[0].type === "CLOSE_POSITION") {
@@ -2212,8 +2202,7 @@ var init_tpslTriggerPrice = __esm({
2212
2202
  ]);
2213
2203
  const child = React2.useMemo(() => {
2214
2204
  const children = [];
2215
- if (!order?.symbol)
2216
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-" });
2205
+ if (!order?.symbol) return /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-" });
2217
2206
  if (props.takeProfitPrice) {
2218
2207
  children.push(
2219
2208
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2263,8 +2252,7 @@ var init_tpslTriggerPrice = __esm({
2263
2252
  )
2264
2253
  );
2265
2254
  }
2266
- if (children.length === 0)
2267
- return /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-" });
2255
+ if (children.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { children: "-" });
2268
2256
  if (children.length === 2 && direction === "row") {
2269
2257
  children.splice(1, 0, /* @__PURE__ */ jsxRuntime.jsx("span", { children: "/" }, "split"));
2270
2258
  }
@@ -2860,10 +2848,8 @@ function tpslAction(option) {
2860
2848
  };
2861
2849
  }
2862
2850
  function compareNumbers(a, b) {
2863
- if (a > b)
2864
- return 1;
2865
- if (a < b)
2866
- return -1;
2851
+ if (a > b) return 1;
2852
+ if (a < b) return -1;
2867
2853
  return 0;
2868
2854
  }
2869
2855
  function estTotalValue(record, isPending) {
@@ -3681,8 +3667,7 @@ var init_items = __esm({
3681
3667
  MobileTooltip = (props) => {
3682
3668
  const { classNames, content } = props;
3683
3669
  const [open, setOpen] = React2.useState(false);
3684
- if (typeof content === "undefined")
3685
- return props.children;
3670
+ if (typeof content === "undefined") return props.children;
3686
3671
  return /* @__PURE__ */ jsxRuntime.jsx(
3687
3672
  ui.Tooltip,
3688
3673
  {
@@ -3772,8 +3757,7 @@ var init_bracketOrderPrice_ui = __esm({
3772
3757
  order: props.order
3773
3758
  });
3774
3759
  };
3775
- if (!props.sl_trigger_price && !props.tp_trigger_price)
3776
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
3760
+ if (!props.sl_trigger_price && !props.tp_trigger_price) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
3777
3761
  return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 1, itemAlign: "center", justify: "start", children: [
3778
3762
  /* @__PURE__ */ jsxRuntime.jsx(
3779
3763
  MobileTooltip,
@@ -3951,8 +3935,7 @@ var init_cancelBtn_script = __esm({
3951
3935
  const { onCancelOrder } = useOrderListContext();
3952
3936
  const [isLoading, setIsLoading] = React2.useState(false);
3953
3937
  const onCancel = (event) => {
3954
- if (!onCancelOrder)
3955
- return Promise.resolve();
3938
+ if (!onCancelOrder) return Promise.resolve();
3956
3939
  event?.preventDefault();
3957
3940
  event?.stopPropagation();
3958
3941
  setIsLoading(true);
@@ -5415,15 +5398,13 @@ var init_useFormatOrderHistory = __esm({
5415
5398
  }
5416
5399
  });
5417
5400
  function offsetStartOfDay(date) {
5418
- if (date == null)
5419
- return date;
5401
+ if (date == null) return date;
5420
5402
  const newDate = new Date(date);
5421
5403
  newDate.setHours(0, 0, 0, 0);
5422
5404
  return newDate;
5423
5405
  }
5424
5406
  function offsetEndOfDay(date) {
5425
- if (date == null)
5426
- return date;
5407
+ if (date == null) return date;
5427
5408
  const newDate = new Date(date);
5428
5409
  newDate.setHours(23, 59, 59, 999);
5429
5410
  return newDate;
@@ -5935,5 +5916,5 @@ var init_orders_widget = __esm({
5935
5916
  init_orders_widget();
5936
5917
  init_orders_script();
5937
5918
  init_orderList();
5938
- //# sourceMappingURL=out.js.map
5919
+ //# sourceMappingURL=index.js.map
5939
5920
  //# sourceMappingURL=index.js.map