@orderly.network/layout-split 2.0.4-alpha.0 → 2.0.4-alpha.1
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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +94 -122
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +95 -123
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -420,7 +420,8 @@ declare const TRADINGVIEW_MIN_WIDTH = 540;
|
|
|
420
420
|
declare const DATA_LIST_MAX_HEIGHT = 800;
|
|
421
421
|
declare const DATA_LIST_INITIAL_HEIGHT = 350;
|
|
422
422
|
declare const SPACE = 8;
|
|
423
|
-
|
|
423
|
+
/** Baseline reservation for symbol info chrome (aligned with trading-next DesktopLayout sans countdown). */
|
|
424
|
+
declare const SYMBOL_INFO_BAR_HEIGHT = 56;
|
|
424
425
|
type MarketLayoutPosition = "left" | "top" | "bottom" | "hide";
|
|
425
426
|
type PanelSize = "small" | "middle" | "large";
|
|
426
427
|
interface UseSplitLayoutOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -420,7 +420,8 @@ declare const TRADINGVIEW_MIN_WIDTH = 540;
|
|
|
420
420
|
declare const DATA_LIST_MAX_HEIGHT = 800;
|
|
421
421
|
declare const DATA_LIST_INITIAL_HEIGHT = 350;
|
|
422
422
|
declare const SPACE = 8;
|
|
423
|
-
|
|
423
|
+
/** Baseline reservation for symbol info chrome (aligned with trading-next DesktopLayout sans countdown). */
|
|
424
|
+
declare const SYMBOL_INFO_BAR_HEIGHT = 56;
|
|
424
425
|
type MarketLayoutPosition = "left" | "top" | "bottom" | "hide";
|
|
425
426
|
type PanelSize = "small" | "middle" | "large";
|
|
426
427
|
interface UseSplitLayoutOptions {
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ function ResizablePanelGroup({
|
|
|
51
51
|
{
|
|
52
52
|
"data-slot": "resizable-panel-group",
|
|
53
53
|
className: ui.cn(
|
|
54
|
-
"aria-[orientation=vertical]:oui-flex-col
|
|
54
|
+
"oui-flex oui-size-full aria-[orientation=vertical]:oui-flex-col",
|
|
55
55
|
className
|
|
56
56
|
),
|
|
57
57
|
...props
|
|
@@ -81,11 +81,11 @@ function ResizableHandle({
|
|
|
81
81
|
{
|
|
82
82
|
"data-slot": "resizable-handle",
|
|
83
83
|
className: ui.cn(
|
|
84
|
-
"oui-
|
|
84
|
+
"oui-relative oui-flex oui-w-px oui-items-center oui-justify-center oui-bg-primary after:oui-absolute after:oui-inset-y-0 after:oui-left-1/2 after:oui-w-1 after:-oui-translate-x-1/2 focus:oui-ring-0 focus-visible:oui-outline-none focus-visible:oui-ring-0 aria-[orientation=horizontal]:oui-h-px aria-[orientation=horizontal]:oui-w-full aria-[orientation=horizontal]:after:oui-left-0 aria-[orientation=horizontal]:after:oui-h-1 aria-[orientation=horizontal]:after:oui-w-full aria-[orientation=horizontal]:after:-oui-translate-y-1/2 aria-[orientation=horizontal]:after:oui-translate-x-0 [&[aria-orientation=horizontal]>div]:oui-rotate-90",
|
|
85
85
|
className
|
|
86
86
|
),
|
|
87
87
|
...props,
|
|
88
|
-
children: withHandle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-
|
|
88
|
+
children: withHandle && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-z-10 oui-flex oui-h-6 oui-w-1 oui-shrink-0 oui-rounded-lg oui-bg-primary" })
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
}
|
|
@@ -158,7 +158,7 @@ function SplitLayout({
|
|
|
158
158
|
});
|
|
159
159
|
onSizeChange?.(sizesAsStrings);
|
|
160
160
|
},
|
|
161
|
-
[onSizeChange, count]
|
|
161
|
+
[onSizeChange, count, sizes]
|
|
162
162
|
);
|
|
163
163
|
if (count === 0) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
164
164
|
const marginPx = gap != null ? gap * 2 : 4;
|
|
@@ -1228,9 +1228,9 @@ var LayoutSwitchButton = ({
|
|
|
1228
1228
|
{
|
|
1229
1229
|
justify: position === "right" ? "end" : "start",
|
|
1230
1230
|
className: ui.cn(
|
|
1231
|
-
"oui-
|
|
1232
|
-
"oui-bg-base-10
|
|
1233
|
-
"oui-border-
|
|
1231
|
+
"oui-h-[100px] oui-w-[148px]",
|
|
1232
|
+
"oui-rounded-[10px] oui-bg-base-10",
|
|
1233
|
+
"oui-border-4 oui-border-base-5 group-hover:oui-border-primary-light",
|
|
1234
1234
|
layout === position && "!oui-border-primary-light"
|
|
1235
1235
|
),
|
|
1236
1236
|
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { p: 1, children: /* @__PURE__ */ jsxRuntime.jsx(OrderEntryIcon, {}) })
|
|
@@ -1283,7 +1283,7 @@ var LayoutSwitchButton = ({
|
|
|
1283
1283
|
onMouseLeave: () => setHoveredMarket(null),
|
|
1284
1284
|
className: "oui-group",
|
|
1285
1285
|
children: [
|
|
1286
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "center", className: "oui-
|
|
1286
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: "center", className: "oui-h-[100px] oui-w-[148px]", children: [
|
|
1287
1287
|
position === "left" && /* @__PURE__ */ jsxRuntime.jsx(MarketLeftIcon, { isSelected, isHovered }),
|
|
1288
1288
|
position === "top" && /* @__PURE__ */ jsxRuntime.jsx(MarketTopIcon, { isSelected, isHovered }),
|
|
1289
1289
|
position === "bottom" && /* @__PURE__ */ jsxRuntime.jsx(MarketBottomIcon, { isSelected, isHovered }),
|
|
@@ -1437,7 +1437,7 @@ var TRADINGVIEW_MIN_WIDTH = 540;
|
|
|
1437
1437
|
var DATA_LIST_MAX_HEIGHT = 800;
|
|
1438
1438
|
var DATA_LIST_INITIAL_HEIGHT = 350;
|
|
1439
1439
|
var SPACE = 8;
|
|
1440
|
-
var SYMBOL_INFO_BAR_HEIGHT =
|
|
1440
|
+
var SYMBOL_INFO_BAR_HEIGHT = 56;
|
|
1441
1441
|
var ORDERLY_ORDER_ENTRY_SIDE_MARKETS_LAYOUT = "orderly_order_entry_side_markets_layout";
|
|
1442
1442
|
var ORDERLY_SIDE_MARKETS_MODE_KEY = "orderly_side_markets_mode";
|
|
1443
1443
|
var ORDERLY_HORIZONTAL_MARKETS_LAYOUT = "orderly_horizontal_markets_layout";
|
|
@@ -1671,8 +1671,7 @@ function useSplitLayout(options = {}) {
|
|
|
1671
1671
|
const {
|
|
1672
1672
|
initialLayout = "right",
|
|
1673
1673
|
initialMarketLayout = "left",
|
|
1674
|
-
canTrade = true
|
|
1675
|
-
isFirstTimeDeposit = false
|
|
1674
|
+
canTrade = true
|
|
1676
1675
|
} = options;
|
|
1677
1676
|
const max2XL = hooks.useMediaQuery("(max-width: 1279px)");
|
|
1678
1677
|
const min3XL = hooks.useMediaQuery("(min-width: 1440px)");
|
|
@@ -1727,30 +1726,6 @@ function useSplitLayout(options = {}) {
|
|
|
1727
1726
|
ORDERLY_ORDER_ENTRY_EXTRA_HEIGHT,
|
|
1728
1727
|
0
|
|
1729
1728
|
);
|
|
1730
|
-
React.useCallback(
|
|
1731
|
-
(preSize, nextSize, boxHeight) => {
|
|
1732
|
-
if (!boxHeight) return;
|
|
1733
|
-
const splitTradingviewHeight = boxHeight * preSize / 100;
|
|
1734
|
-
const splitOrderbookHeight = boxHeight * nextSize / 100;
|
|
1735
|
-
const tradingviewHeight = Math.min(
|
|
1736
|
-
Math.max(splitTradingviewHeight, TRADINGVIEW_MIN_HEIGHT),
|
|
1737
|
-
max2XL ? 1200 : 600
|
|
1738
|
-
);
|
|
1739
|
-
const orderbookHeight = Math.min(
|
|
1740
|
-
Math.max(splitOrderbookHeight, ORDERBOOK_MIN_HEIGHT),
|
|
1741
|
-
ORDERBOOK_MAX_HEIGHT
|
|
1742
|
-
);
|
|
1743
|
-
if (splitOrderbookHeight >= orderbookHeight) {
|
|
1744
|
-
const offset = splitOrderbookHeight - orderbookHeight;
|
|
1745
|
-
setExtraHeight(Math.max(0, extraHeight - offset));
|
|
1746
|
-
} else if (tradingviewHeight + orderbookHeight < (max2XL ? 1200 : 600) + ORDERBOOK_MAX_HEIGHT) {
|
|
1747
|
-
const height = tradingviewHeight + orderbookHeight + SPACE + SYMBOL_INFO_BAR_HEIGHT;
|
|
1748
|
-
const offset = Math.max(0, height - 0);
|
|
1749
|
-
setExtraHeight(extraHeight + offset);
|
|
1750
|
-
}
|
|
1751
|
-
},
|
|
1752
|
-
[max2XL, extraHeight, setExtraHeight]
|
|
1753
|
-
);
|
|
1754
1729
|
const tradingviewMaxHeight = max2XL ? 1200 : 600;
|
|
1755
1730
|
const dataListHeight = canTrade ? 379 : 277;
|
|
1756
1731
|
const memoizedPanelSize = React.useMemo(() => {
|
|
@@ -1913,27 +1888,22 @@ var TradingSortablePanel = (props) => {
|
|
|
1913
1888
|
);
|
|
1914
1889
|
};
|
|
1915
1890
|
var SplitLineBar = (props) => {
|
|
1916
|
-
const { onMouseDown, mode = "horizontal", ...rest } = props;
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
);
|
|
1921
|
-
const filteredCls = React.useMemo(
|
|
1922
|
-
() => props.className?.split(" ").filter((cls) => cls !== "disable"),
|
|
1923
|
-
[props.className]
|
|
1924
|
-
);
|
|
1891
|
+
const { onMouseDown, mode = "horizontal", className, ...rest } = props;
|
|
1892
|
+
const tokens = className?.split(/\s+/).filter(Boolean) ?? [];
|
|
1893
|
+
const disable = tokens.includes("disable");
|
|
1894
|
+
const filteredCls = tokens.filter((t) => t !== "disable").join(" ");
|
|
1925
1895
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1926
1896
|
"div",
|
|
1927
1897
|
{
|
|
1928
1898
|
...rest,
|
|
1929
1899
|
className: ui.cn(
|
|
1930
|
-
filteredCls,
|
|
1900
|
+
filteredCls || void 0,
|
|
1931
1901
|
"!oui-transition-none",
|
|
1932
|
-
"!oui-
|
|
1902
|
+
"!oui-bg-transparent !oui-shadow-none",
|
|
1933
1903
|
"hover:!oui-bg-primary-light hover:!oui-shadow-[0px_0px_4px_0px] hover:!oui-shadow-primary-light/80",
|
|
1934
1904
|
"active:!oui-bg-primary-light active:!oui-shadow-[0px_0px_4px_0px] active:!oui-shadow-primary-light/80",
|
|
1935
1905
|
"focus:!oui-bg-primary-light focus:!oui-shadow-[0px_0px_4px_0px] focus:!oui-shadow-primary-light/80",
|
|
1936
|
-
mode === "horizontal" ? "!oui-
|
|
1906
|
+
mode === "horizontal" ? "!oui-mx-[3px] !oui-w-[2px] !oui-min-w-[2px]" : "!oui-my-[3px] !oui-h-[2px] !oui-min-h-[2px]",
|
|
1937
1907
|
disable && "oui-pointer-events-none"
|
|
1938
1908
|
),
|
|
1939
1909
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1975,6 +1945,18 @@ var DEFAULT_SORTABLE_ITEMS = [
|
|
|
1975
1945
|
layoutCore.TRADING_PANEL_IDS.ASSETS,
|
|
1976
1946
|
layoutCore.TRADING_PANEL_IDS.ORDER_ENTRY
|
|
1977
1947
|
];
|
|
1948
|
+
function orderEntrySortablePanelClassName(id) {
|
|
1949
|
+
if (id === layoutCore.TRADING_PANEL_IDS.MARGIN || id === "margin") {
|
|
1950
|
+
return "oui-trading-riskRate-container";
|
|
1951
|
+
}
|
|
1952
|
+
if (id === layoutCore.TRADING_PANEL_IDS.ASSETS || id === "assets") {
|
|
1953
|
+
return "oui-trading-assetsView-container oui-border oui-border-line-12";
|
|
1954
|
+
}
|
|
1955
|
+
if (id === layoutCore.TRADING_PANEL_IDS.ORDER_ENTRY || id === "orderEntry") {
|
|
1956
|
+
return "oui-trading-orderEntry-container";
|
|
1957
|
+
}
|
|
1958
|
+
return void 0;
|
|
1959
|
+
}
|
|
1978
1960
|
var dropAnimationConfig = {
|
|
1979
1961
|
keyframes({
|
|
1980
1962
|
transform
|
|
@@ -2016,8 +1998,6 @@ function SplitTradingLayout(props) {
|
|
|
2016
1998
|
max2XL,
|
|
2017
1999
|
max4XL,
|
|
2018
2000
|
horizontalDraggable,
|
|
2019
|
-
panelSize,
|
|
2020
|
-
setPanelSize,
|
|
2021
2001
|
marketsWidth,
|
|
2022
2002
|
mainSplitSize,
|
|
2023
2003
|
setMainSplitSize,
|
|
@@ -2029,17 +2009,34 @@ function SplitTradingLayout(props) {
|
|
|
2029
2009
|
setDataListSplitHeightSM,
|
|
2030
2010
|
orderBookSplitHeightSM,
|
|
2031
2011
|
setOrderbookSplitHeightSM,
|
|
2032
|
-
tradingviewMaxHeight
|
|
2012
|
+
tradingviewMaxHeight,
|
|
2033
2013
|
extraHeight,
|
|
2034
2014
|
setExtraHeight,
|
|
2035
|
-
dataListHeight: dataListMinHeight
|
|
2036
|
-
symbolInfoBarHeight
|
|
2015
|
+
dataListHeight: dataListMinHeight
|
|
2037
2016
|
} = useSplitLayout();
|
|
2017
|
+
const symbolInfoBarChromeRef = React.useRef(null);
|
|
2018
|
+
const [symbolBarChromeHeight, setSymbolBarChromeHeight] = React.useState(
|
|
2019
|
+
SYMBOL_INFO_BAR_HEIGHT
|
|
2020
|
+
);
|
|
2021
|
+
React.useLayoutEffect(() => {
|
|
2022
|
+
const el = symbolInfoBarChromeRef.current;
|
|
2023
|
+
if (!el) return;
|
|
2024
|
+
const sync = () => {
|
|
2025
|
+
const next = el.getBoundingClientRect().height;
|
|
2026
|
+
if (!(Number.isFinite(next) && next > 0)) return;
|
|
2027
|
+
setSymbolBarChromeHeight(
|
|
2028
|
+
(prev) => Math.round(Math.abs(prev - next)) >= 1 ? Math.round(next) : prev
|
|
2029
|
+
);
|
|
2030
|
+
};
|
|
2031
|
+
sync();
|
|
2032
|
+
const observer = new ResizeObserver(sync);
|
|
2033
|
+
observer.observe(el);
|
|
2034
|
+
return () => observer.disconnect();
|
|
2035
|
+
}, []);
|
|
2038
2036
|
const [tradingViewFullScreen] = hooks.useLocalStorage(
|
|
2039
2037
|
types.TradingviewFullscreenKey,
|
|
2040
2038
|
false
|
|
2041
2039
|
);
|
|
2042
|
-
const [animating, setAnimating] = React.useState(false);
|
|
2043
2040
|
const [sortableItems, setSortableItems] = hooks.useLocalStorage(
|
|
2044
2041
|
ORDER_ENTRY_SORT_KEY,
|
|
2045
2042
|
DEFAULT_SORTABLE_ITEMS
|
|
@@ -2087,9 +2084,9 @@ function SplitTradingLayout(props) {
|
|
|
2087
2084
|
}
|
|
2088
2085
|
const onMainSplitSizeChange = (width) => layout === "left" ? setMainSplitSize(`${100 - Math.min(Number(width), 100)}`) : setMainSplitSize(width);
|
|
2089
2086
|
const minScreenHeight = React.useMemo(() => {
|
|
2090
|
-
return tradingViewFullScreen ? 0 :
|
|
2091
|
-
}, [tradingViewFullScreen,
|
|
2092
|
-
const minScreenHeightSM = TOP_BAR_HEIGHT + BOTTOM_BAR_HEIGHT +
|
|
2087
|
+
return tradingViewFullScreen ? 0 : symbolBarChromeHeight + ORDERBOOK_MAX_HEIGHT + DATA_LIST_INITIAL_HEIGHT + SPACE * 4;
|
|
2088
|
+
}, [tradingViewFullScreen, symbolBarChromeHeight]);
|
|
2089
|
+
const minScreenHeightSM = TOP_BAR_HEIGHT + BOTTOM_BAR_HEIGHT + symbolBarChromeHeight + TRADINGVIEW_MIN_HEIGHT + ORDERBOOK_MIN_HEIGHT + dataListMinHeight + SPACE * 4;
|
|
2093
2090
|
const containerPaddingX = React.useMemo(() => max4XL ? 12 : 8, [max4XL]);
|
|
2094
2091
|
const getPanel = (id) => panels.get(id)?.node ?? null;
|
|
2095
2092
|
const horizontalMarketsView = getPanel(layoutCore.TRADING_PANEL_IDS.HORIZONTAL_MARKETS);
|
|
@@ -2120,22 +2117,10 @@ function SplitTradingLayout(props) {
|
|
|
2120
2117
|
width: marketsWidth,
|
|
2121
2118
|
style: { minWidth: marketsWidth },
|
|
2122
2119
|
className: "oui-trading-markets-container oui-transition-all oui-duration-150",
|
|
2123
|
-
|
|
2124
|
-
children: !animating && marketLayout === "left" && marketsWidget
|
|
2125
|
-
}
|
|
2126
|
-
);
|
|
2127
|
-
const symbolInfoBarView = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2128
|
-
ui.Box,
|
|
2129
|
-
{
|
|
2130
|
-
className: "oui-trading-symbolInfoBar-container",
|
|
2131
|
-
intensity: 900,
|
|
2132
|
-
r: "2xl",
|
|
2133
|
-
px: 3,
|
|
2134
|
-
width: "100%",
|
|
2135
|
-
style: { minHeight: symbolInfoBarHeight, height: symbolInfoBarHeight },
|
|
2136
|
-
children: getPanel(layoutCore.TRADING_PANEL_IDS.SYMBOL_INFO_BAR)
|
|
2120
|
+
children: marketLayout === "left" && marketsWidget
|
|
2137
2121
|
}
|
|
2138
2122
|
);
|
|
2123
|
+
const symbolInfoBarView = getPanel(layoutCore.TRADING_PANEL_IDS.SYMBOL_INFO_BAR);
|
|
2139
2124
|
const tradingviewWidget = getPanel(layoutCore.TRADING_PANEL_IDS.TRADING_VIEW);
|
|
2140
2125
|
const tradingView = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2141
2126
|
ui.Box,
|
|
@@ -2194,15 +2179,7 @@ function SplitTradingLayout(props) {
|
|
|
2194
2179
|
{
|
|
2195
2180
|
id,
|
|
2196
2181
|
showIndicator: showPositionIcon,
|
|
2197
|
-
className:
|
|
2198
|
-
id === layoutCore.TRADING_PANEL_IDS.MARGIN && "oui-trading-riskRate-container",
|
|
2199
|
-
id === layoutCore.TRADING_PANEL_IDS.ASSETS && "oui-trading-assetsView-container oui-border oui-border-line-12",
|
|
2200
|
-
id === layoutCore.TRADING_PANEL_IDS.ORDER_ENTRY && "oui-trading-orderEntry-container",
|
|
2201
|
-
// Support legacy short-name keys
|
|
2202
|
-
id === "margin" && "oui-trading-riskRate-container",
|
|
2203
|
-
id === "assets" && "oui-trading-assetsView-container oui-border oui-border-line-12",
|
|
2204
|
-
id === "orderEntry" && "oui-trading-orderEntry-container"
|
|
2205
|
-
),
|
|
2182
|
+
className: orderEntrySortablePanelClassName(id),
|
|
2206
2183
|
children: getPanel(id)
|
|
2207
2184
|
},
|
|
2208
2185
|
id
|
|
@@ -2259,7 +2236,7 @@ function SplitTradingLayout(props) {
|
|
|
2259
2236
|
ui.Flex,
|
|
2260
2237
|
{
|
|
2261
2238
|
direction: "column",
|
|
2262
|
-
className: "oui-flex-1 oui-overflow-hidden",
|
|
2239
|
+
className: "oui-min-h-0 oui-flex-1 oui-overflow-hidden",
|
|
2263
2240
|
gap: 2,
|
|
2264
2241
|
style: {
|
|
2265
2242
|
minWidth: max4XL ? marketsWidth + TRADINGVIEW_MIN_WIDTH + ORDERBOOK_MIN_WIDTH + SPACE * 2 : TRADINGVIEW_MIN_WIDTH + ORDERBOOK_MIN_WIDTH + SPACE
|
|
@@ -2270,9 +2247,12 @@ function SplitTradingLayout(props) {
|
|
|
2270
2247
|
TradingSplitLayout,
|
|
2271
2248
|
{
|
|
2272
2249
|
style: {
|
|
2273
|
-
|
|
2250
|
+
flex: 1,
|
|
2251
|
+
minHeight: 0,
|
|
2252
|
+
width: "100%",
|
|
2253
|
+
overflow: "hidden"
|
|
2274
2254
|
},
|
|
2275
|
-
className: "oui-w-full",
|
|
2255
|
+
className: "oui-flex oui-min-h-0 oui-w-full oui-flex-1 oui-overflow-hidden",
|
|
2276
2256
|
mode: "vertical",
|
|
2277
2257
|
onSizeChange: setDataListSplitSize,
|
|
2278
2258
|
children: [
|
|
@@ -2349,17 +2329,17 @@ function SplitTradingLayout(props) {
|
|
|
2349
2329
|
),
|
|
2350
2330
|
style: {
|
|
2351
2331
|
minHeight: Math.max(
|
|
2352
|
-
|
|
2332
|
+
symbolBarChromeHeight + TRADINGVIEW_MIN_HEIGHT + ORDERBOOK_MIN_HEIGHT + SPACE * 2,
|
|
2353
2333
|
orderEntryHeight
|
|
2354
2334
|
),
|
|
2355
|
-
maxHeight:
|
|
2335
|
+
maxHeight: symbolBarChromeHeight + tradingviewMaxHeight + ORDERBOOK_MAX_HEIGHT + SPACE * 2
|
|
2356
2336
|
},
|
|
2357
2337
|
children: [
|
|
2358
2338
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2359
2339
|
ui.Flex,
|
|
2360
2340
|
{
|
|
2361
2341
|
height: "100%",
|
|
2362
|
-
className: "oui-w-[calc(100%_-_280px_-_12px)] oui-flex-1",
|
|
2342
|
+
className: "oui-min-h-0 oui-w-[calc(100%_-_280px_-_12px)] oui-flex-1",
|
|
2363
2343
|
direction: "column",
|
|
2364
2344
|
gapY: 2,
|
|
2365
2345
|
children: [
|
|
@@ -2368,15 +2348,15 @@ function SplitTradingLayout(props) {
|
|
|
2368
2348
|
ui.Flex,
|
|
2369
2349
|
{
|
|
2370
2350
|
width: "100%",
|
|
2371
|
-
height: "100%",
|
|
2372
2351
|
gapX: 2,
|
|
2373
2352
|
itemAlign: "stretch",
|
|
2374
2353
|
style: {
|
|
2354
|
+
flex: 1,
|
|
2375
2355
|
minHeight: TRADINGVIEW_MIN_HEIGHT + ORDERBOOK_MIN_HEIGHT + SPACE,
|
|
2376
|
-
maxHeight:
|
|
2356
|
+
maxHeight: tradingviewMaxHeight + ORDERBOOK_MAX_HEIGHT + SPACE
|
|
2377
2357
|
},
|
|
2378
2358
|
className: ui.cn(
|
|
2379
|
-
"oui-flex-1",
|
|
2359
|
+
"oui-min-h-0 oui-flex-1",
|
|
2380
2360
|
layout === "left" && "oui-flex-row-reverse"
|
|
2381
2361
|
),
|
|
2382
2362
|
children: [
|
|
@@ -2389,7 +2369,7 @@ function SplitTradingLayout(props) {
|
|
|
2389
2369
|
width: marketsWidth,
|
|
2390
2370
|
style: {
|
|
2391
2371
|
minHeight: TRADINGVIEW_MIN_HEIGHT + ORDERBOOK_MIN_HEIGHT + SPACE,
|
|
2392
|
-
maxHeight:
|
|
2372
|
+
maxHeight: tradingviewMaxHeight + ORDERBOOK_MAX_HEIGHT + SPACE
|
|
2393
2373
|
},
|
|
2394
2374
|
children: marketsWidget
|
|
2395
2375
|
}
|
|
@@ -2412,7 +2392,7 @@ function SplitTradingLayout(props) {
|
|
|
2412
2392
|
r: "2xl",
|
|
2413
2393
|
style: {
|
|
2414
2394
|
minHeight: TRADINGVIEW_MIN_HEIGHT,
|
|
2415
|
-
maxHeight:
|
|
2395
|
+
maxHeight: tradingviewMaxHeight,
|
|
2416
2396
|
height: 1200
|
|
2417
2397
|
},
|
|
2418
2398
|
children: tradingviewWidget
|
|
@@ -2835,7 +2815,7 @@ var CollapsiblePanel = ({
|
|
|
2835
2815
|
"div",
|
|
2836
2816
|
{
|
|
2837
2817
|
className: ui.cn(
|
|
2838
|
-
"oui-flex oui-flex-col oui-gap-y-5 oui-overflow-hidden oui-rounded-2xl oui-bg-base-9
|
|
2818
|
+
"oui-flex oui-size-full oui-flex-col oui-gap-y-5 oui-overflow-hidden oui-rounded-2xl oui-bg-base-9",
|
|
2839
2819
|
className
|
|
2840
2820
|
),
|
|
2841
2821
|
style: computedStyle,
|
|
@@ -3161,20 +3141,24 @@ function updateSizeAtPath(node, path, newSizes) {
|
|
|
3161
3141
|
}
|
|
3162
3142
|
return updatedNode;
|
|
3163
3143
|
}
|
|
3164
|
-
function
|
|
3165
|
-
const
|
|
3166
|
-
const
|
|
3167
|
-
|
|
3168
|
-
|
|
3144
|
+
function collectPanelCollapseState(root) {
|
|
3145
|
+
const collapsiblePanels = /* @__PURE__ */ new Map();
|
|
3146
|
+
const collapsedPanels = /* @__PURE__ */ new Set();
|
|
3147
|
+
const traverse = (node) => {
|
|
3148
|
+
if (node.type === "panel" && node.id) {
|
|
3149
|
+
collapsiblePanels.set(node.id, node.collapsible ?? false);
|
|
3150
|
+
if (node.defaultCollapsed) {
|
|
3151
|
+
collapsedPanels.add(node.id);
|
|
3152
|
+
}
|
|
3169
3153
|
}
|
|
3170
|
-
if (
|
|
3171
|
-
for (const child of
|
|
3154
|
+
if (node.type === "split" || node.type === "sort") {
|
|
3155
|
+
for (const child of node.children ?? []) {
|
|
3172
3156
|
traverse(child);
|
|
3173
3157
|
}
|
|
3174
3158
|
}
|
|
3175
3159
|
};
|
|
3176
|
-
traverse(
|
|
3177
|
-
return
|
|
3160
|
+
traverse(root);
|
|
3161
|
+
return { collapsiblePanels, collapsedPanels };
|
|
3178
3162
|
}
|
|
3179
3163
|
function createUpdatedLayout(rootNode, layout, breakpoint, path, sizes) {
|
|
3180
3164
|
const updatedRoot = updateSizeAtPath(rootNode, path, sizes);
|
|
@@ -3227,36 +3211,24 @@ function SplitRenderer(props) {
|
|
|
3227
3211
|
},
|
|
3228
3212
|
[computeUpdatedLayout, onLayoutPersist]
|
|
3229
3213
|
);
|
|
3230
|
-
const collapsiblePanels = React.useMemo(
|
|
3231
|
-
() =>
|
|
3214
|
+
const { collapsiblePanels, collapsedPanels } = React.useMemo(
|
|
3215
|
+
() => collectPanelCollapseState(rootNode),
|
|
3232
3216
|
[rootNode]
|
|
3233
3217
|
);
|
|
3234
|
-
const collapsedPanels = React.useMemo(() => {
|
|
3235
|
-
const collapsed = /* @__PURE__ */ new Set();
|
|
3236
|
-
const traverse = (node) => {
|
|
3237
|
-
if (node.type === "panel" && node.id && node.defaultCollapsed) {
|
|
3238
|
-
collapsed.add(node.id);
|
|
3239
|
-
}
|
|
3240
|
-
if (node.type === "split" || node.type === "sort") {
|
|
3241
|
-
node.children?.forEach(traverse);
|
|
3242
|
-
}
|
|
3243
|
-
};
|
|
3244
|
-
traverse(rootNode);
|
|
3245
|
-
return collapsed;
|
|
3246
|
-
}, [rootNode]);
|
|
3247
3218
|
const computeUpdatedLayoutForCollapse = React.useCallback(
|
|
3248
3219
|
(panelId, collapsed) => {
|
|
3249
|
-
const
|
|
3220
|
+
const layouts = { ...layout.layouts };
|
|
3250
3221
|
for (const bp of BREAKPOINT_KEYS) {
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3222
|
+
const nodeAtBreakpoint = layouts[bp];
|
|
3223
|
+
if (nodeAtBreakpoint) {
|
|
3224
|
+
layouts[bp] = updateDefaultCollapsedAtPath(
|
|
3225
|
+
nodeAtBreakpoint,
|
|
3254
3226
|
panelId,
|
|
3255
3227
|
collapsed
|
|
3256
3228
|
);
|
|
3257
3229
|
}
|
|
3258
3230
|
}
|
|
3259
|
-
return { ...layout, layouts
|
|
3231
|
+
return { ...layout, layouts };
|
|
3260
3232
|
},
|
|
3261
3233
|
[layout]
|
|
3262
3234
|
);
|
|
@@ -3311,7 +3283,7 @@ function SplitRenderer(props) {
|
|
|
3311
3283
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3312
3284
|
"div",
|
|
3313
3285
|
{
|
|
3314
|
-
className: "oui-fixed oui-
|
|
3286
|
+
className: "oui-fixed oui-bottom-5 oui-right-2 oui-flex oui-flex-col oui-items-end oui-text-lg oui-text-trade-loss",
|
|
3315
3287
|
style: { zIndex: 1e3 },
|
|
3316
3288
|
children: [
|
|
3317
3289
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: breakpoint }),
|
|
@@ -3320,7 +3292,7 @@ function SplitRenderer(props) {
|
|
|
3320
3292
|
"button",
|
|
3321
3293
|
{
|
|
3322
3294
|
onClick: () => ctx?.reset(),
|
|
3323
|
-
className: "oui-mt-1 oui-px-2 oui-py-1 oui-text-sm oui-
|
|
3295
|
+
className: "oui-mt-1 oui-rounded oui-bg-gray-500 oui-px-2 oui-py-1 oui-text-sm oui-text-white",
|
|
3324
3296
|
children: "Reset"
|
|
3325
3297
|
}
|
|
3326
3298
|
)
|