@orderly.network/ui-orders 2.0.1-alpha.6 → 2.0.1-alpha.8

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.d.mts CHANGED
@@ -1,48 +1,33 @@
1
1
  import * as react from 'react';
2
- import { FC } from 'react';
2
+ import { ForwardedRef, FC } from 'react';
3
+ import { SharePnLConfig, SharePnLParams } from '@orderly.network/ui-share';
4
+ import * as _orderly_network_ui from '@orderly.network/ui';
5
+ import { Table } from '@orderly.network/ui';
3
6
  import * as _orderly_network_types from '@orderly.network/types';
4
- import { OrderStatus, API, OrderSide } from '@orderly.network/types';
5
- import { PaginationMeta } from '@orderly.network/ui';
7
+ import { API, OrderStatus, OrderSide } from '@orderly.network/types';
6
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
9
 
8
- declare enum TabType {
9
- all = "all",
10
- pending = "pending",
11
- tp_sl = "tp_sl",
12
- filled = "filled",
13
- cancelled = "cancelled",
14
- rejected = "rejected",
15
- orderHistory = "orderHistory"
16
- }
17
- declare const OrdersWidget: FC<{
18
- current?: TabType;
19
- pnlNotionalDecimalPrecision?: number;
20
- }>;
21
-
22
- declare const useOrdersScript: (props: {
23
- current?: TabType;
24
- pnlNotionalDecimalPrecision?: number;
25
- }) => {
26
- current: TabType | undefined;
27
- pnlNotionalDecimalPrecision: number | undefined;
10
+ type OrderListInstance = {
11
+ download?: () => void;
28
12
  };
29
- type OrdersBuilderState$1 = ReturnType<typeof useOrdersScript>;
30
-
31
- declare const useOrderListScript: (props: {
13
+ type useOrderListScriptOptions = {
32
14
  type: TabType;
33
- ordersStatus?: OrderStatus | undefined;
34
- symbol?: string | undefined;
35
- enableLoadMore?: boolean | undefined;
36
- onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
15
+ ordersStatus?: OrderStatus;
16
+ symbol?: string;
17
+ enableLoadMore?: boolean;
18
+ onSymbolChange?: (symbol: API.Symbol) => void;
19
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
37
20
  filterConfig?: {
38
- side?: OrderSide | "all" | undefined;
21
+ side?: OrderSide | "all";
39
22
  range?: {
40
- from?: Date | undefined;
41
- to?: Date | undefined;
42
- } | undefined;
43
- } | undefined;
44
- pnlNotionalDecimalPrecision?: number | undefined;
45
- }) => {
23
+ from?: Date;
24
+ to?: Date;
25
+ };
26
+ };
27
+ pnlNotionalDecimalPrecision?: number;
28
+ ref?: ForwardedRef<OrderListInstance>;
29
+ };
30
+ declare const useOrderListScript: (props: useOrderListScriptOptions) => {
46
31
  type: TabType;
47
32
  dataSource: any[] | undefined;
48
33
  isLoading: boolean;
@@ -51,17 +36,12 @@ declare const useOrderListScript: (props: {
51
36
  updateOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
52
37
  cancelAlgoOrder: (orderId: number, symbol?: string | undefined) => Promise<any>;
53
38
  updateAlgoOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
54
- page: number;
55
- pageSize: number;
56
- setPage: react.Dispatch<react.SetStateAction<number>>;
57
- setPageSize: (size: number) => void;
58
- meta: {
59
- count: number;
39
+ pagination: _orderly_network_ui.PaginationMeta | {
60
40
  page: number;
61
41
  pageSize: number;
62
- pageTotal: number;
42
+ onPageChange: react.Dispatch<react.SetStateAction<number>>;
43
+ onPageSizeChange: (size: number) => void;
63
44
  };
64
- pagination: PaginationMeta;
65
45
  manualPagination: boolean;
66
46
  pnlNotionalDecimalPrecision: number | undefined;
67
47
  onFilter: (filter: {
@@ -71,11 +51,52 @@ declare const useOrderListScript: (props: {
71
51
  filterItems: any[];
72
52
  onCancelAll: () => void;
73
53
  onSymbolChange: ((symbol: API.Symbol) => void) | undefined;
54
+ sharePnLConfig: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
55
+ tableInstance: react.MutableRefObject<Table<any> | undefined>;
56
+ symbolsInfo: {
57
+ [x: string]: (key?: keyof API.SymbolExt | undefined, defaultValue?: (string | number) | undefined) => any;
58
+ } & {
59
+ isNil: boolean;
60
+ };
74
61
  };
75
- type OrdersBuilderState = ReturnType<typeof useOrderListScript>;
62
+ type OrdersBuilderState$1 = ReturnType<typeof useOrderListScript>;
76
63
 
77
- declare const DesktopOrderList: FC<OrdersBuilderState>;
78
- declare const MobileOrderList: FC<OrdersBuilderState & {
64
+ declare enum TabType {
65
+ all = "all",
66
+ pending = "pending",
67
+ tp_sl = "tp_sl",
68
+ filled = "filled",
69
+ cancelled = "cancelled",
70
+ rejected = "rejected",
71
+ orderHistory = "orderHistory"
72
+ }
73
+ type OrdersWidgetProps = {
74
+ current?: TabType;
75
+ pnlNotionalDecimalPrecision?: number;
76
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
77
+ };
78
+ declare const OrdersWidget: react.ForwardRefExoticComponent<OrdersWidgetProps & react.RefAttributes<OrderListInstance>>;
79
+
80
+ type UseOrdersScriptOptions = {
81
+ current?: TabType;
82
+ pnlNotionalDecimalPrecision?: number;
83
+ ref: ForwardedRef<OrderListInstance>;
84
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
85
+ };
86
+ declare const useOrdersScript: (props: UseOrdersScriptOptions) => {
87
+ current: TabType | undefined;
88
+ pnlNotionalDecimalPrecision: number | undefined;
89
+ orderListRef: react.RefObject<OrderListInstance>;
90
+ sharePnLConfig: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
91
+ };
92
+ type OrdersBuilderState = ReturnType<typeof useOrdersScript>;
93
+
94
+ declare const DesktopOrderList: FC<OrdersBuilderState$1 & {
95
+ testIds?: {
96
+ tableBody?: string;
97
+ };
98
+ }>;
99
+ declare const MobileOrderList: FC<OrdersBuilderState$1 & {
79
100
  classNames?: {
80
101
  root?: string;
81
102
  cell?: string;
@@ -84,20 +105,26 @@ declare const MobileOrderList: FC<OrdersBuilderState & {
84
105
  showFilter?: boolean;
85
106
  }>;
86
107
 
87
- declare const DesktopOrderListWidget: (props: {
108
+ type DesktopOrderListWidgetProps = {
88
109
  type: TabType;
89
- ordersStatus?: OrderStatus | undefined;
110
+ ordersStatus?: OrderStatus;
90
111
  /** if has value, will be fetch current symbol orders*/
91
- symbol?: string | undefined;
92
- onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
93
- pnlNotionalDecimalPrecision?: number | undefined;
94
- }) => react_jsx_runtime.JSX.Element;
112
+ symbol?: string;
113
+ onSymbolChange?: (symbol: API.Symbol) => void;
114
+ pnlNotionalDecimalPrecision?: number;
115
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
116
+ testIds?: {
117
+ tableBody?: string;
118
+ };
119
+ };
120
+ declare const DesktopOrderListWidget: react.ForwardRefExoticComponent<DesktopOrderListWidgetProps & react.RefAttributes<OrderListInstance>>;
95
121
  declare const MobileOrderListWidget: (props: {
96
122
  type: TabType;
97
123
  ordersStatus?: OrderStatus | undefined;
98
124
  /** if has value, will be fetch current symbol orders*/
99
125
  symbol?: string | undefined;
100
126
  onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
127
+ sharePnLConfig?: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
101
128
  classNames?: {
102
129
  root?: string | undefined;
103
130
  cell?: string | undefined;
@@ -113,4 +140,4 @@ declare const MobileOrderListWidget: (props: {
113
140
  } | undefined;
114
141
  }) => react_jsx_runtime.JSX.Element;
115
142
 
116
- export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, type OrdersBuilderState$1 as OrdersBuilderState, OrdersWidget, TabType, useOrderListScript, useOrdersScript };
143
+ export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, type OrderListInstance, type OrdersBuilderState, OrdersWidget, TabType, useOrderListScript, useOrdersScript };
package/dist/index.d.ts CHANGED
@@ -1,48 +1,33 @@
1
1
  import * as react from 'react';
2
- import { FC } from 'react';
2
+ import { ForwardedRef, FC } from 'react';
3
+ import { SharePnLConfig, SharePnLParams } from '@orderly.network/ui-share';
4
+ import * as _orderly_network_ui from '@orderly.network/ui';
5
+ import { Table } from '@orderly.network/ui';
3
6
  import * as _orderly_network_types from '@orderly.network/types';
4
- import { OrderStatus, API, OrderSide } from '@orderly.network/types';
5
- import { PaginationMeta } from '@orderly.network/ui';
7
+ import { API, OrderStatus, OrderSide } from '@orderly.network/types';
6
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
9
 
8
- declare enum TabType {
9
- all = "all",
10
- pending = "pending",
11
- tp_sl = "tp_sl",
12
- filled = "filled",
13
- cancelled = "cancelled",
14
- rejected = "rejected",
15
- orderHistory = "orderHistory"
16
- }
17
- declare const OrdersWidget: FC<{
18
- current?: TabType;
19
- pnlNotionalDecimalPrecision?: number;
20
- }>;
21
-
22
- declare const useOrdersScript: (props: {
23
- current?: TabType;
24
- pnlNotionalDecimalPrecision?: number;
25
- }) => {
26
- current: TabType | undefined;
27
- pnlNotionalDecimalPrecision: number | undefined;
10
+ type OrderListInstance = {
11
+ download?: () => void;
28
12
  };
29
- type OrdersBuilderState$1 = ReturnType<typeof useOrdersScript>;
30
-
31
- declare const useOrderListScript: (props: {
13
+ type useOrderListScriptOptions = {
32
14
  type: TabType;
33
- ordersStatus?: OrderStatus | undefined;
34
- symbol?: string | undefined;
35
- enableLoadMore?: boolean | undefined;
36
- onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
15
+ ordersStatus?: OrderStatus;
16
+ symbol?: string;
17
+ enableLoadMore?: boolean;
18
+ onSymbolChange?: (symbol: API.Symbol) => void;
19
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
37
20
  filterConfig?: {
38
- side?: OrderSide | "all" | undefined;
21
+ side?: OrderSide | "all";
39
22
  range?: {
40
- from?: Date | undefined;
41
- to?: Date | undefined;
42
- } | undefined;
43
- } | undefined;
44
- pnlNotionalDecimalPrecision?: number | undefined;
45
- }) => {
23
+ from?: Date;
24
+ to?: Date;
25
+ };
26
+ };
27
+ pnlNotionalDecimalPrecision?: number;
28
+ ref?: ForwardedRef<OrderListInstance>;
29
+ };
30
+ declare const useOrderListScript: (props: useOrderListScriptOptions) => {
46
31
  type: TabType;
47
32
  dataSource: any[] | undefined;
48
33
  isLoading: boolean;
@@ -51,17 +36,12 @@ declare const useOrderListScript: (props: {
51
36
  updateOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
52
37
  cancelAlgoOrder: (orderId: number, symbol?: string | undefined) => Promise<any>;
53
38
  updateAlgoOrder: (orderId: string, order: _orderly_network_types.OrderEntity) => Promise<any>;
54
- page: number;
55
- pageSize: number;
56
- setPage: react.Dispatch<react.SetStateAction<number>>;
57
- setPageSize: (size: number) => void;
58
- meta: {
59
- count: number;
39
+ pagination: _orderly_network_ui.PaginationMeta | {
60
40
  page: number;
61
41
  pageSize: number;
62
- pageTotal: number;
42
+ onPageChange: react.Dispatch<react.SetStateAction<number>>;
43
+ onPageSizeChange: (size: number) => void;
63
44
  };
64
- pagination: PaginationMeta;
65
45
  manualPagination: boolean;
66
46
  pnlNotionalDecimalPrecision: number | undefined;
67
47
  onFilter: (filter: {
@@ -71,11 +51,52 @@ declare const useOrderListScript: (props: {
71
51
  filterItems: any[];
72
52
  onCancelAll: () => void;
73
53
  onSymbolChange: ((symbol: API.Symbol) => void) | undefined;
54
+ sharePnLConfig: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
55
+ tableInstance: react.MutableRefObject<Table<any> | undefined>;
56
+ symbolsInfo: {
57
+ [x: string]: (key?: keyof API.SymbolExt | undefined, defaultValue?: (string | number) | undefined) => any;
58
+ } & {
59
+ isNil: boolean;
60
+ };
74
61
  };
75
- type OrdersBuilderState = ReturnType<typeof useOrderListScript>;
62
+ type OrdersBuilderState$1 = ReturnType<typeof useOrderListScript>;
76
63
 
77
- declare const DesktopOrderList: FC<OrdersBuilderState>;
78
- declare const MobileOrderList: FC<OrdersBuilderState & {
64
+ declare enum TabType {
65
+ all = "all",
66
+ pending = "pending",
67
+ tp_sl = "tp_sl",
68
+ filled = "filled",
69
+ cancelled = "cancelled",
70
+ rejected = "rejected",
71
+ orderHistory = "orderHistory"
72
+ }
73
+ type OrdersWidgetProps = {
74
+ current?: TabType;
75
+ pnlNotionalDecimalPrecision?: number;
76
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
77
+ };
78
+ declare const OrdersWidget: react.ForwardRefExoticComponent<OrdersWidgetProps & react.RefAttributes<OrderListInstance>>;
79
+
80
+ type UseOrdersScriptOptions = {
81
+ current?: TabType;
82
+ pnlNotionalDecimalPrecision?: number;
83
+ ref: ForwardedRef<OrderListInstance>;
84
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
85
+ };
86
+ declare const useOrdersScript: (props: UseOrdersScriptOptions) => {
87
+ current: TabType | undefined;
88
+ pnlNotionalDecimalPrecision: number | undefined;
89
+ orderListRef: react.RefObject<OrderListInstance>;
90
+ sharePnLConfig: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
91
+ };
92
+ type OrdersBuilderState = ReturnType<typeof useOrdersScript>;
93
+
94
+ declare const DesktopOrderList: FC<OrdersBuilderState$1 & {
95
+ testIds?: {
96
+ tableBody?: string;
97
+ };
98
+ }>;
99
+ declare const MobileOrderList: FC<OrdersBuilderState$1 & {
79
100
  classNames?: {
80
101
  root?: string;
81
102
  cell?: string;
@@ -84,20 +105,26 @@ declare const MobileOrderList: FC<OrdersBuilderState & {
84
105
  showFilter?: boolean;
85
106
  }>;
86
107
 
87
- declare const DesktopOrderListWidget: (props: {
108
+ type DesktopOrderListWidgetProps = {
88
109
  type: TabType;
89
- ordersStatus?: OrderStatus | undefined;
110
+ ordersStatus?: OrderStatus;
90
111
  /** if has value, will be fetch current symbol orders*/
91
- symbol?: string | undefined;
92
- onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
93
- pnlNotionalDecimalPrecision?: number | undefined;
94
- }) => react_jsx_runtime.JSX.Element;
112
+ symbol?: string;
113
+ onSymbolChange?: (symbol: API.Symbol) => void;
114
+ pnlNotionalDecimalPrecision?: number;
115
+ sharePnLConfig?: SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>;
116
+ testIds?: {
117
+ tableBody?: string;
118
+ };
119
+ };
120
+ declare const DesktopOrderListWidget: react.ForwardRefExoticComponent<DesktopOrderListWidgetProps & react.RefAttributes<OrderListInstance>>;
95
121
  declare const MobileOrderListWidget: (props: {
96
122
  type: TabType;
97
123
  ordersStatus?: OrderStatus | undefined;
98
124
  /** if has value, will be fetch current symbol orders*/
99
125
  symbol?: string | undefined;
100
126
  onSymbolChange?: ((symbol: API.Symbol) => void) | undefined;
127
+ sharePnLConfig?: (SharePnLConfig & Partial<Omit<SharePnLParams, "position" | "refCode" | "leverage">>) | undefined;
101
128
  classNames?: {
102
129
  root?: string | undefined;
103
130
  cell?: string | undefined;
@@ -113,4 +140,4 @@ declare const MobileOrderListWidget: (props: {
113
140
  } | undefined;
114
141
  }) => react_jsx_runtime.JSX.Element;
115
142
 
116
- export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, type OrdersBuilderState$1 as OrdersBuilderState, OrdersWidget, TabType, useOrderListScript, useOrdersScript };
143
+ export { DesktopOrderList, DesktopOrderListWidget, MobileOrderList, MobileOrderListWidget, type OrderListInstance, type OrdersBuilderState, OrdersWidget, TabType, useOrderListScript, useOrdersScript };