@orderly.network/ui-orders 2.8.3 → 2.8.4

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
@@ -2,7 +2,7 @@ import React2, { forwardRef, useMemo, useEffect, useRef, useImperativeHandle, us
2
2
  import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useConfig, useOrderEntity, useReferralInfo, useLeverageBySymbol } from '@orderly.network/hooks';
3
3
  import { useTranslation, Trans, i18n } from '@orderly.network/i18n';
4
4
  import { OrderStatus, AlgoOrderRootType, AlgoOrderType, OrderSide, OrderType, EMPTY_LIST } from '@orderly.network/types';
5
- import { Decimal, commify, commifyOptional, getTrailingStopPrice, formatNum } from '@orderly.network/utils';
5
+ import { formatSymbol, Decimal, commify, commifyOptional, getTrailingStopPrice, formatNum } from '@orderly.network/utils';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
  import { usePagination, modal, Text, Button, ThrottledButton, CloseIcon, cn, Flex, Input, inputFormatter, Slider, DataFilter, TableFeatures, Grid, Picker, ListView, Tabs, TabPanel, Badge, Tooltip, EditIcon, toast as toast$1, Popover, PopoverRoot, PopoverTrigger, PopoverContent, Divider, ShareIcon, CheckIcon, Statistic, SimpleDialog, useModal, Checkbox } from '@orderly.network/ui';
8
8
  import { useDataTap, useOrderEntryFormErrorMsg } from '@orderly.network/react-app';
@@ -5320,6 +5320,8 @@ var init_orderList_ui = __esm({
5320
5320
  };
5321
5321
  CancelAll = (props) => {
5322
5322
  const { t } = useTranslation();
5323
+ const { symbol } = props;
5324
+ const formattedSymbol = symbol ? formatSymbol(symbol, "base") : symbol;
5323
5325
  return /* @__PURE__ */ jsx(
5324
5326
  Button,
5325
5327
  {
@@ -5330,7 +5332,7 @@ var init_orderList_ui = __esm({
5330
5332
  className: "disabled:oui-bg-transport",
5331
5333
  onClick: (e) => props.onCancelAll(),
5332
5334
  "data-testid": `oui-testid-dataList-${props.type.toLowerCase()}-cancelAll-button`,
5333
- children: t("orders.cancelAll")
5335
+ children: symbol ? t("orders.cancelAll.ofSymbol", { symbol: formattedSymbol }) : t("orders.cancelAll")
5334
5336
  }
5335
5337
  );
5336
5338
  };
@@ -5387,7 +5389,7 @@ function offsetEndOfDay(date) {
5387
5389
  newDate.setHours(23, 59, 59, 999);
5388
5390
  return newDate;
5389
5391
  }
5390
- var useOrderListScript, useFilter, formatDatePickerRange;
5392
+ var useOrderListScript, useFilter, formatDatePickerRange, getDialogInfo;
5391
5393
  var init_orderList_script = __esm({
5392
5394
  "src/components/orderList/orderList.script.tsx"() {
5393
5395
  init_util();
@@ -5456,7 +5458,7 @@ var init_orderList_script = __esm({
5456
5458
  updateOrder,
5457
5459
  cancelAlgoOrder,
5458
5460
  updateAlgoOrder,
5459
- cancelAllOrders,
5461
+ cancelAllPendingOrders,
5460
5462
  cancelAllTPSLOrders,
5461
5463
  meta,
5462
5464
  refresh
@@ -5484,8 +5486,7 @@ var init_orderList_script = __esm({
5484
5486
  }
5485
5487
  }, [pageSize, typePageSize]);
5486
5488
  const onCancelAll = useCallback(() => {
5487
- const title = props.type === "pending" /* pending */ ? t("orders.pending.cancelAll") : props.type === "tp_sl" /* tp_sl */ ? t("orders.tpsl.cancelAll") : "";
5488
- const content = t("orders.pending.cancelAll.description") ;
5489
+ const { title, content } = getDialogInfo(type, t, props.symbol);
5489
5490
  modal.confirm({
5490
5491
  title,
5491
5492
  content: /* @__PURE__ */ jsx(Text, { size: "sm", children: content }),
@@ -5494,9 +5495,9 @@ var init_orderList_script = __esm({
5494
5495
  onOk: async () => {
5495
5496
  try {
5496
5497
  if (type === "tp_sl" /* tp_sl */) {
5497
- await cancelAllTPSLOrders();
5498
+ await cancelAllTPSLOrders(props.symbol);
5498
5499
  } else {
5499
- await cancelAllOrders();
5500
+ await cancelAllPendingOrders(props.symbol);
5500
5501
  }
5501
5502
  refresh();
5502
5503
  return Promise.resolve(true);
@@ -5510,7 +5511,7 @@ var init_orderList_script = __esm({
5510
5511
  }
5511
5512
  }
5512
5513
  });
5513
- }, [type, t]);
5514
+ }, [type, t, props.symbol]);
5514
5515
  const formattedData = useFormatOrderHistory(data ?? []);
5515
5516
  const dataSource = useDataTap(type !== "tp_sl" /* tp_sl */ ? formattedData : data, {
5516
5517
  fallbackData: []
@@ -5542,7 +5543,8 @@ var init_orderList_script = __esm({
5542
5543
  tableInstance,
5543
5544
  symbolsInfo,
5544
5545
  filterDays,
5545
- updateFilterDays
5546
+ updateFilterDays,
5547
+ symbol: props.symbol
5546
5548
  };
5547
5549
  };
5548
5550
  useFilter = (type, option) => {
@@ -5696,6 +5698,46 @@ var init_orderList_script = __esm({
5696
5698
  from: offsetStartOfDay(option.from),
5697
5699
  to: offsetEndOfDay(option.to ?? option.from)
5698
5700
  });
5701
+ getDialogInfo = (type, t, symbol) => {
5702
+ const formattedSymbol = symbol ? formatSymbol(symbol, "base") : symbol;
5703
+ switch (type) {
5704
+ case "pending" /* pending */:
5705
+ if (symbol !== void 0) {
5706
+ return {
5707
+ title: t("orders.pending.cancelAll.forSymbol", {
5708
+ symbol: formattedSymbol
5709
+ }),
5710
+ content: t("orders.pending.cancelAll.forSymbol.description", {
5711
+ symbol: formattedSymbol
5712
+ })
5713
+ };
5714
+ }
5715
+ return {
5716
+ title: t("orders.pending.cancelAll"),
5717
+ content: t("orders.pending.cancelAll.description")
5718
+ };
5719
+ case "tp_sl" /* tp_sl */:
5720
+ if (symbol !== void 0) {
5721
+ return {
5722
+ title: t("orders.tpsl.cancelAll.forSymbol", {
5723
+ symbol: formattedSymbol
5724
+ }),
5725
+ content: t("orders.tpsl.cancelAll.forSymbol.description", {
5726
+ symbol: formattedSymbol
5727
+ })
5728
+ };
5729
+ }
5730
+ return {
5731
+ title: t("orders.tpsl.cancelAll"),
5732
+ content: t("orders.tpsl.cancelAll.description")
5733
+ };
5734
+ default:
5735
+ return {
5736
+ title: "",
5737
+ content: ""
5738
+ };
5739
+ }
5740
+ };
5699
5741
  }
5700
5742
  });
5701
5743
  var DesktopOrderListWidget, MobileOrderListWidget;