MCPcopy Create free account
hub / github.com/DTStack/molecule / WorkbenchView

Function WorkbenchView

src/workbench/workbench.tsx:54–182  ·  view source on GitHub ↗
(props: IWorkbench & ILayout & ILayoutController)

Source from the content-addressed store, hash-verified

52const layoutService = container.resolve(LayoutService);
53
54export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
55 const {
56 activityBar,
57 auxiliaryBar,
58 menuBar,
59 panel,
60 sidebar,
61 statusBar,
62 onPaneSizeChange,
63 onWorkbenchDidMount,
64 onHorizontalPaneSizeChange,
65 splitPanePos,
66 horizontalSplitPanePos,
67 } = props;
68
69 const getSizes = () => {
70 if (panel.hidden) {
71 return ['100%', 0];
72 }
73 if (panel.panelMaximized) {
74 return [0, '100%'];
75 }
76 return horizontalSplitPanePos;
77 };
78
79 const getContentSize = () => {
80 if (!sidebar.hidden && !auxiliaryBar.hidden) return splitPanePos;
81
82 if (sidebar.hidden) {
83 return auxiliaryBar.hidden
84 ? [0, '100%', 0]
85 : [0, 'auto', splitPanePos[2]];
86 }
87
88 return [splitPanePos[0], 'auto', 0];
89 };
90
91 const getContentSashes = () => {
92 if (!sidebar.hidden && !auxiliaryBar.hidden) return true;
93
94 if (sidebar.hidden) {
95 return auxiliaryBar.hidden ? false : [false, true];
96 }
97
98 return [true, false];
99 };
100
101 const handleContentChanged = (sizes: number[]) => {
102 const nextPos: number[] = [];
103 nextPos[0] = sidebar.hidden ? Number(splitPanePos[0]) : sizes[0];
104 nextPos[2] = auxiliaryBar.hidden ? Number(splitPanePos[2]) : sizes[2];
105
106 nextPos[1] =
107 sizes.reduce((acc, cur) => acc + cur, 0) - nextPos[0] - nextPos[2];
108
109 onPaneSizeChange?.(nextPos);
110 };
111

Callers

nothing calls this directly

Calls 4

classNamesFunction · 0.90
getContentSizeFunction · 0.85
getContentSashesFunction · 0.85
getSizesFunction · 0.85

Tested by

no test coverage detected