@orderly.network/ui-orders 2.11.3-rc.0 → 2.12.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
@@ -1,10 +1,10 @@
1
1
  import React2, { forwardRef, useMemo, useEffect, useRef, useImperativeHandle, useCallback, useState, createContext, memo, useContext } from 'react';
2
- import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useConfig, useTpslPriceChecker, useOrderEntity, useReferralInfo, useLeverageBySymbol } from '@orderly.network/hooks';
2
+ import { useSymbolsInfo, useOrderStream, useLocalStorage, utils, useThrottledCallback, useMutation, useSWRConfig, useAccount, unstable_serialize, useMemoizedFn, getMinNotional, findTPSLFromOrder, findTPSLOrderPriceFromOrder, useMaxQty, useBadgeBySymbol, useConfig, useTpslPriceChecker, useOrderEntity, useReferralInfo, useLeverageBySymbol } from '@orderly.network/hooks';
3
3
  import { useTranslation, Trans, i18n } from '@orderly.network/i18n';
4
4
  import { OrderStatus, AlgoOrderRootType, MarginMode, AlgoOrderType, OrderSide, OrderType, EMPTY_LIST } from '@orderly.network/types';
5
5
  import { formatSymbol, Decimal, commify, commifyOptional, getTrailingStopPrice, formatNum } from '@orderly.network/utils';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
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';
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, SymbolBadge as SymbolBadge$1, SimpleDialog, useModal, Checkbox } from '@orderly.network/ui';
8
8
  import { useDataTap, useOrderEntryFormErrorMsg } from '@orderly.network/react-app';
9
9
  import { PositionTPSLPopover, CloseToLiqPriceIcon, PositionTPSLSheet } from '@orderly.network/ui-tpsl';
10
10
  import { format, subDays, differenceInDays } from 'date-fns';
@@ -305,6 +305,7 @@ var init_shareButton_script = __esm({
305
305
  const { sharePnLConfig, order, iconSize } = props;
306
306
  const { t } = useTranslation();
307
307
  const { getFirstRefCode } = useReferralInfo();
308
+ const { brokerNameRaw } = useBadgeBySymbol(order.symbol);
308
309
  const refCode = useMemo(() => {
309
310
  return getFirstRefCode()?.code;
310
311
  }, [getFirstRefCode]);
@@ -322,7 +323,8 @@ var init_shareButton_script = __esm({
322
323
  },
323
324
  refCode,
324
325
  leverage,
325
- ...sharePnLConfig
326
+ ...sharePnLConfig,
327
+ brokerName: sharePnLConfig?.brokerName ?? brokerNameRaw
326
328
  }
327
329
  });
328
330
  };
@@ -2009,6 +2011,29 @@ var init_triggerPriceCell = __esm({
2009
2011
  };
2010
2012
  }
2011
2013
  });
2014
+ var OrderSymbolCell;
2015
+ var init_orderSymbolCell = __esm({
2016
+ "src/components/orderList/desktop/orderSymbolCell.tsx"() {
2017
+ OrderSymbolCell = (props) => {
2018
+ const { symbol, onSymbolChange } = props;
2019
+ const { brokerId, brokerName, brokerNameRaw } = useBadgeBySymbol(symbol);
2020
+ return /* @__PURE__ */ jsx(
2021
+ Text.symbolBadge,
2022
+ {
2023
+ className: "oui-cursor-pointer",
2024
+ badge: brokerName ?? brokerId ?? void 0,
2025
+ fullName: brokerNameRaw,
2026
+ onClick: (e) => {
2027
+ onSymbolChange?.({ symbol });
2028
+ e.stopPropagation();
2029
+ e.preventDefault();
2030
+ },
2031
+ children: symbol
2032
+ }
2033
+ );
2034
+ };
2035
+ }
2036
+ });
2012
2037
  var Renew;
2013
2038
  var init_renew = __esm({
2014
2039
  "src/components/orderList/desktop/renew.tsx"() {
@@ -2385,23 +2410,17 @@ function instrument(option) {
2385
2410
  "div",
2386
2411
  {
2387
2412
  className: cn(
2388
- "oui-h-7 oui-w-1 oui-shrink-0 oui-rounded-[1px]",
2413
+ "oui-h-[34px] oui-w-1 oui-shrink-0 oui-rounded-[1px]",
2389
2414
  record.side === OrderSide.BUY ? "oui-bg-trade-profit" : "oui-bg-trade-loss"
2390
2415
  )
2391
2416
  }
2392
2417
  ),
2393
2418
  /* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "start", gap: 1, children: [
2394
2419
  /* @__PURE__ */ jsx(
2395
- Text.formatted,
2420
+ OrderSymbolCell,
2396
2421
  {
2397
- size: "xs",
2398
- className: "oui-cursor-pointer oui-text-xs",
2399
- onClick: (e) => {
2400
- option?.onSymbolChange?.({ symbol: value });
2401
- e.stopPropagation();
2402
- e.preventDefault();
2403
- },
2404
- children: `${value.split("_")[1]}-PERP`
2422
+ symbol: value,
2423
+ onSymbolChange: option?.onSymbolChange
2405
2424
  }
2406
2425
  ),
2407
2426
  option?.showType && /* @__PURE__ */ jsx(Flex, { direction: "row", gap: 1, wrap: "wrap", children: parseBadgesFor(record)?.map((e, index) => /* @__PURE__ */ jsx(
@@ -2932,6 +2951,7 @@ var init_useColumn = __esm({
2932
2951
  init_quantityCell();
2933
2952
  init_trailingCallbackCell();
2934
2953
  init_triggerPriceCell();
2954
+ init_orderSymbolCell();
2935
2955
  init_renew();
2936
2956
  init_tpslEdit();
2937
2957
  init_tpslPrice();
@@ -2950,7 +2970,7 @@ var init_useColumn = __esm({
2950
2970
  case "all" /* all */:
2951
2971
  return [
2952
2972
  instrument({
2953
- width: 174,
2973
+ width: 200,
2954
2974
  showType: true,
2955
2975
  onSymbolChange,
2956
2976
  enableSort: false
@@ -2988,7 +3008,7 @@ var init_useColumn = __esm({
2988
3008
  case "pending" /* pending */:
2989
3009
  return [
2990
3010
  instrument({
2991
- width: 172,
3011
+ width: 200,
2992
3012
  showType: true,
2993
3013
  onSymbolChange,
2994
3014
  enableSort: false
@@ -3012,7 +3032,7 @@ var init_useColumn = __esm({
3012
3032
  case "tp_sl" /* tp_sl */:
3013
3033
  return [
3014
3034
  instrument({
3015
- width: 176,
3035
+ width: 200,
3016
3036
  showType: true,
3017
3037
  onSymbolChange,
3018
3038
  enableSort: false
@@ -3030,7 +3050,7 @@ var init_useColumn = __esm({
3030
3050
  return [
3031
3051
  instrument({
3032
3052
  showType: true,
3033
- width: 166,
3053
+ width: 200,
3034
3054
  onSymbolChange
3035
3055
  }),
3036
3056
  // type({ width: 124 }),
@@ -3065,7 +3085,7 @@ var init_useColumn = __esm({
3065
3085
  return [
3066
3086
  instrument({
3067
3087
  showType: true,
3068
- width: 154,
3088
+ width: 200,
3069
3089
  onSymbolChange,
3070
3090
  enableSort: false
3071
3091
  }),
@@ -3089,7 +3109,7 @@ var init_useColumn = __esm({
3089
3109
  return [
3090
3110
  instrument({
3091
3111
  showType: true,
3092
- width: 154,
3112
+ width: 200,
3093
3113
  onSymbolChange
3094
3114
  }),
3095
3115
  // side({ width: 124 }),
@@ -3112,7 +3132,7 @@ var init_useColumn = __esm({
3112
3132
  return [
3113
3133
  instrument({
3114
3134
  showType: true,
3115
- width: 160,
3135
+ width: 200,
3116
3136
  onSymbolChange
3117
3137
  }),
3118
3138
  // side({ width: 124 }),
@@ -3150,10 +3170,23 @@ var init_useColumn = __esm({
3150
3170
  };
3151
3171
  }
3152
3172
  });
3173
+ var SymbolBadge;
3174
+ var init_symbolBadge = __esm({
3175
+ "src/components/symbolBadge.tsx"() {
3176
+ SymbolBadge = (props) => {
3177
+ const { brokerId, brokerName, brokerNameRaw } = useBadgeBySymbol(
3178
+ props.symbol
3179
+ );
3180
+ const badge = brokerName ?? brokerId ?? void 0;
3181
+ return /* @__PURE__ */ jsx(SymbolBadge$1, { badge, fullName: brokerNameRaw });
3182
+ };
3183
+ }
3184
+ });
3153
3185
  var SymbolToken, OrderTypeView, OrderTime, OrderState, Qty, Filled, EstTotal, TriggerPrice, MarkPrice, LimitPrice, TPTrigger, SLTrigger, TPPrice, SLPrice, TPSLQuantity, AvgPrice2, OrderPrice, RealizedPnL, MobileTooltip, Fee, TrailingCallback, TrailingPrice;
3154
3186
  var init_items = __esm({
3155
3187
  "src/components/orderList/mobile/items.tsx"() {
3156
3188
  init_util();
3189
+ init_symbolBadge();
3157
3190
  init_tpslOrderRowContext();
3158
3191
  SymbolToken = (props) => {
3159
3192
  const { item } = props;
@@ -3164,9 +3197,10 @@ var init_items = __esm({
3164
3197
  {
3165
3198
  intensity: 80,
3166
3199
  rule: "symbol",
3167
- formatString: "base-type",
3200
+ formatString: "base",
3168
3201
  size: "sm",
3169
3202
  prefix: /* @__PURE__ */ jsx(Badge, { color: isBuy ? "success" : "danger", size: "xs", children: isBuy ? t("common.buy") : t("common.sell") }),
3203
+ suffix: /* @__PURE__ */ jsx(SymbolBadge, { symbol: item.symbol }),
3170
3204
  onClick: () => {
3171
3205
  props.onSymbolChange?.({ symbol: item.symbol });
3172
3206
  },
@@ -4101,6 +4135,7 @@ var ConfirmDialogContent;
4101
4135
  var init_editDialogContent = __esm({
4102
4136
  "src/components/orderList/mobile/editSheet/components/editDialogContent.tsx"() {
4103
4137
  init_util();
4138
+ init_symbolBadge();
4104
4139
  ConfirmDialogContent = (props) => {
4105
4140
  const { item } = props;
4106
4141
  const {
@@ -4123,16 +4158,19 @@ var init_editDialogContent = __esm({
4123
4158
  }
4124
4159
  ),
4125
4160
  /* @__PURE__ */ jsxs(Flex, { gap: 2, mb: 3, mt: 2, justify: "between", children: [
4126
- /* @__PURE__ */ jsx(
4127
- Text.formatted,
4128
- {
4129
- rule: "symbol",
4130
- formatString: "base-type",
4131
- size: "base",
4132
- showIcon: true,
4133
- children: item.symbol
4134
- }
4135
- ),
4161
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", itemAlign: "start", gap: 1, grow: true, children: [
4162
+ /* @__PURE__ */ jsx(
4163
+ Text.formatted,
4164
+ {
4165
+ rule: "symbol",
4166
+ formatString: "base",
4167
+ size: "base",
4168
+ showIcon: true,
4169
+ children: item.symbol
4170
+ }
4171
+ ),
4172
+ /* @__PURE__ */ jsx(SymbolBadge, { symbol: item.symbol })
4173
+ ] }),
4136
4174
  /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
4137
4175
  parseBadgesFor(item)?.map((e, index) => /* @__PURE__ */ jsx(
4138
4176
  Badge,
@@ -4274,11 +4312,22 @@ var EditSheetHeader;
4274
4312
  var init_editSheetHeader = __esm({
4275
4313
  "src/components/orderList/mobile/editSheet/components/editSheetHeader.tsx"() {
4276
4314
  init_util();
4315
+ init_symbolBadge();
4277
4316
  EditSheetHeader = (props) => {
4278
4317
  const { item } = props;
4279
4318
  const { t } = useTranslation();
4280
4319
  return /* @__PURE__ */ jsxs(Flex, { width: "100%", justify: "between", children: [
4281
- /* @__PURE__ */ jsx(Text.formatted, { rule: "symbol", showIcon: true, intensity: 80, children: item.symbol }),
4320
+ /* @__PURE__ */ jsx(
4321
+ Text.formatted,
4322
+ {
4323
+ rule: "symbol",
4324
+ formatString: "base",
4325
+ showIcon: true,
4326
+ intensity: 80,
4327
+ suffix: /* @__PURE__ */ jsx(SymbolBadge, { symbol: item.symbol }),
4328
+ children: item.symbol
4329
+ }
4330
+ ),
4282
4331
  /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 1, children: [
4283
4332
  parseBadgesFor(props.item)?.map((e, index) => /* @__PURE__ */ jsx(
4284
4333
  Badge,
@@ -5537,7 +5586,7 @@ var init_orderList_script = __esm({
5537
5586
  page: enableLoadMore || !manualPagination ? void 0 : page,
5538
5587
  // pending and ts_sl list get all data
5539
5588
  size: manualPagination ? pageSize : 500,
5540
- sourceTypeAll: type === "orderHistory" /* orderHistory */,
5589
+ sourceTypeAll: type === "orderHistory" /* orderHistory */ || type === "filled" /* filled */,
5541
5590
  dateRange,
5542
5591
  includes,
5543
5592
  excludes