@finos/legend-application-studio 28.18.25 → 28.18.27
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/editor/ActivityBar.d.ts +3 -1
- package/lib/components/editor/ActivityBar.d.ts.map +1 -1
- package/lib/components/editor/ActivityBar.js +10 -4
- package/lib/components/editor/ActivityBar.js.map +1 -1
- package/lib/components/editor/Editor.d.ts.map +1 -1
- package/lib/components/editor/Editor.js +14 -2
- package/lib/components/editor/Editor.js.map +1 -1
- package/lib/components/editor/ShowcaseSideBar.d.ts +24 -0
- package/lib/components/editor/ShowcaseSideBar.d.ts.map +1 -0
- package/lib/components/editor/ShowcaseSideBar.js +36 -0
- package/lib/components/editor/ShowcaseSideBar.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/EditorStore.d.ts +3 -0
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +18 -2
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/package.json +5 -5
- package/src/components/editor/ActivityBar.tsx +15 -4
- package/src/components/editor/Editor.tsx +32 -2
- package/src/components/editor/ShowcaseSideBar.tsx +66 -0
- package/src/stores/editor/EditorStore.ts +25 -2
- package/tsconfig.json +1 -0
@@ -34,6 +34,7 @@ import {
|
|
34
34
|
import { GrammarTextEditor } from './editor-group/GrammarTextEditor.js';
|
35
35
|
import { StatusBar } from './StatusBar.js';
|
36
36
|
import { ActivityBar } from './ActivityBar.js';
|
37
|
+
import { ShowcaseSideBar } from './ShowcaseSideBar.js';
|
37
38
|
import type { WorkspaceEditorPathParams } from '../../__lib__/LegendStudioNavigation.js';
|
38
39
|
import { ProjectSearchCommand } from '../editor/command-center/ProjectSearchCommand.js';
|
39
40
|
import { guaranteeNonNullable, isNonNullable } from '@finos/legend-shared';
|
@@ -53,6 +54,7 @@ import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../__lib__/
|
|
53
54
|
import { EmbeddedQueryBuilder } from './EmbeddedQueryBuilder.js';
|
54
55
|
import { GRAPH_EDITOR_MODE } from '../../stores/editor/EditorConfig.js';
|
55
56
|
import { QuickInput } from './QuickInput.js';
|
57
|
+
import { ShowcaseManager } from '../ShowcaseManager.js';
|
56
58
|
|
57
59
|
export const Editor = withEditorStore(
|
58
60
|
observer(() => {
|
@@ -118,6 +120,22 @@ export const Editor = withEditorStore(
|
|
118
120
|
const maximizedCollapsiblePanelGroupProps = getCollapsiblePanelGroupProps(
|
119
121
|
editorStore.panelGroupDisplayState.isMaximized,
|
120
122
|
);
|
123
|
+
// handle resizing showcase sidebar
|
124
|
+
const showcaseResizeSideBar = (
|
125
|
+
handleProps: ResizablePanelHandlerProps,
|
126
|
+
): void =>
|
127
|
+
editorStore.showcasePanelDisplayState.setSize(
|
128
|
+
(handleProps.domElement as HTMLDivElement).getBoundingClientRect()
|
129
|
+
.width,
|
130
|
+
);
|
131
|
+
|
132
|
+
const showcaseCollapsibleSideBarGroupProps = getCollapsiblePanelGroupProps(
|
133
|
+
editorStore.showcasePanelDisplayState.size === 0,
|
134
|
+
{
|
135
|
+
onStopResize: showcaseResizeSideBar,
|
136
|
+
size: editorStore.showcasePanelDisplayState.size,
|
137
|
+
},
|
138
|
+
);
|
121
139
|
|
122
140
|
useEffect(() => {
|
123
141
|
if (ref.current) {
|
@@ -193,7 +211,6 @@ export const Editor = withEditorStore(
|
|
193
211
|
|
194
212
|
// Cleanup the editor
|
195
213
|
useEffect(() => (): void => editorStore.cleanUp(), [editorStore]);
|
196
|
-
|
197
214
|
return (
|
198
215
|
<div className="app__page">
|
199
216
|
<div className="editor">
|
@@ -210,7 +227,10 @@ export const Editor = withEditorStore(
|
|
210
227
|
</ResizablePanel>
|
211
228
|
<ResizablePanelSplitter />
|
212
229
|
<ResizablePanel
|
213
|
-
{...
|
230
|
+
{...(!editorStore.sideBarDisplayState.isOpen &&
|
231
|
+
!editorStore.showcasePanelDisplayState.isOpen
|
232
|
+
? { flex: 1 }
|
233
|
+
: {})}
|
214
234
|
minSize={300}
|
215
235
|
>
|
216
236
|
<ResizablePanelGroup orientation="horizontal">
|
@@ -250,9 +270,19 @@ export const Editor = withEditorStore(
|
|
250
270
|
</ResizablePanel>
|
251
271
|
</ResizablePanelGroup>
|
252
272
|
</ResizablePanel>
|
273
|
+
<ResizablePanelSplitter />
|
274
|
+
<ResizablePanel
|
275
|
+
{...showcaseCollapsibleSideBarGroupProps.collapsiblePanel}
|
276
|
+
direction={-1}
|
277
|
+
>
|
278
|
+
<div className="panel__content explorer__content__container">
|
279
|
+
<ShowcaseManager />
|
280
|
+
</div>
|
281
|
+
</ResizablePanel>
|
253
282
|
</ResizablePanelGroup>
|
254
283
|
</div>
|
255
284
|
</div>
|
285
|
+
<ShowcaseSideBar />
|
256
286
|
</div>
|
257
287
|
<QuickInput />
|
258
288
|
<StatusBar actionsDisabled={!editable} />
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import { observer } from 'mobx-react-lite';
|
18
|
+
import {
|
19
|
+
MenuContentDivider,
|
20
|
+
DoubleArrowLeft,
|
21
|
+
DoubleArrowRight,
|
22
|
+
} from '@finos/legend-art';
|
23
|
+
import { useEditorStore } from './EditorStoreProvider.js';
|
24
|
+
import type { EditorStore } from '../../stores/editor/EditorStore.js';
|
25
|
+
|
26
|
+
export enum SHOWCASE_PANEL_LOCAL_STORAGE {
|
27
|
+
PANEL_STATE_KEY = 'ShowShowcasePanel',
|
28
|
+
}
|
29
|
+
|
30
|
+
export const toggleShowcasePanel = (editorStore: EditorStore) => {
|
31
|
+
editorStore.showcasePanelDisplayState.toggle();
|
32
|
+
editorStore.applicationStore.userDataService.persistValue(
|
33
|
+
SHOWCASE_PANEL_LOCAL_STORAGE.PANEL_STATE_KEY,
|
34
|
+
editorStore.showcasePanelDisplayState.isOpen,
|
35
|
+
);
|
36
|
+
};
|
37
|
+
|
38
|
+
export const ShowcaseSideBar = observer(() => {
|
39
|
+
const editorStore = useEditorStore();
|
40
|
+
|
41
|
+
return (
|
42
|
+
<div className="activity-bar">
|
43
|
+
<div className="activity-bar__items">
|
44
|
+
<button
|
45
|
+
className="activity-bar__item"
|
46
|
+
onClick={() => {
|
47
|
+
toggleShowcasePanel(editorStore);
|
48
|
+
}}
|
49
|
+
tabIndex={-1}
|
50
|
+
title={
|
51
|
+
editorStore.showcasePanelDisplayState.isOpen
|
52
|
+
? 'Close Showcases'
|
53
|
+
: 'Open Showcases'
|
54
|
+
}
|
55
|
+
>
|
56
|
+
{editorStore.showcasePanelDisplayState.isOpen ? (
|
57
|
+
<DoubleArrowRight />
|
58
|
+
) : (
|
59
|
+
<DoubleArrowLeft />
|
60
|
+
)}
|
61
|
+
</button>
|
62
|
+
<MenuContentDivider />
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
);
|
66
|
+
});
|
@@ -109,7 +109,10 @@ import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceR
|
|
109
109
|
import { SQLPlaygroundPanelState } from './panel-group/SQLPlaygroundPanelState.js';
|
110
110
|
import type { QuickInputState } from './QuickInputState.js';
|
111
111
|
import { GlobalEndToEndWorkflowState } from './sidebar-state/end-to-end-workflow/GlobalEndToEndFlowState.js';
|
112
|
-
import {
|
112
|
+
import {
|
113
|
+
SHOWCASE_PANEL_LOCAL_STORAGE,
|
114
|
+
toggleShowcasePanel,
|
115
|
+
} from '../../components/editor/ShowcaseSideBar.js';
|
113
116
|
import {
|
114
117
|
GraphEditLazyGrammarModeState,
|
115
118
|
LazyTextEditorStore,
|
@@ -196,6 +199,8 @@ export class EditorStore implements CommandRegistrar {
|
|
196
199
|
default: 300,
|
197
200
|
snap: 150,
|
198
201
|
});
|
202
|
+
readonly showcasePanelDisplayState: PanelDisplayState;
|
203
|
+
readonly showcaseDefaultSize = 500;
|
199
204
|
readonly tabManagerState = new EditorTabManagerState(this);
|
200
205
|
supportedElementTypesWithCategory: Map<string, string[]>;
|
201
206
|
|
@@ -303,6 +308,24 @@ export class EditorStore implements CommandRegistrar {
|
|
303
308
|
.filter(isNonNullable);
|
304
309
|
this.supportedElementTypesWithCategory =
|
305
310
|
this.getSupportedElementTypesWithCategory();
|
311
|
+
|
312
|
+
this.showcasePanelDisplayState = new PanelDisplayState({
|
313
|
+
initial: this.showcaseInitialSize,
|
314
|
+
default: this.showcaseDefaultSize,
|
315
|
+
snap: 150,
|
316
|
+
});
|
317
|
+
}
|
318
|
+
|
319
|
+
get showcaseInitialSize(): number {
|
320
|
+
const showcasesSavedAsOpen =
|
321
|
+
this.applicationStore.userDataService.getBooleanValue(
|
322
|
+
SHOWCASE_PANEL_LOCAL_STORAGE.PANEL_STATE_KEY,
|
323
|
+
);
|
324
|
+
if (showcasesSavedAsOpen || showcasesSavedAsOpen === undefined) {
|
325
|
+
return this.showcaseDefaultSize;
|
326
|
+
} else {
|
327
|
+
return 0;
|
328
|
+
}
|
306
329
|
}
|
307
330
|
|
308
331
|
get isInitialized(): boolean {
|
@@ -439,7 +462,7 @@ export class EditorStore implements CommandRegistrar {
|
|
439
462
|
this.conflictResolutionState.hasResolvedAllConflicts),
|
440
463
|
),
|
441
464
|
action: () => {
|
442
|
-
|
465
|
+
toggleShowcasePanel(this);
|
443
466
|
},
|
444
467
|
});
|
445
468
|
this.applicationStore.commandService.registerCommand({
|
package/tsconfig.json
CHANGED
@@ -215,6 +215,7 @@
|
|
215
215
|
"./src/components/editor/EditorStoreProvider.tsx",
|
216
216
|
"./src/components/editor/EmbeddedQueryBuilder.tsx",
|
217
217
|
"./src/components/editor/QuickInput.tsx",
|
218
|
+
"./src/components/editor/ShowcaseSideBar.tsx",
|
218
219
|
"./src/components/editor/StatusBar.tsx",
|
219
220
|
"./src/components/editor/__test-utils__/EditorComponentTestUtils.tsx",
|
220
221
|
"./src/components/editor/command-center/ProjectSearchCommand.tsx",
|