@opensumi/ide-main-layout 3.9.1-next-1748403761.0 → 3.9.1-next-1748425167.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/README.md +30 -31
- package/lib/browser/accordion/accordion.service.d.ts +9 -1
- package/lib/browser/accordion/accordion.service.d.ts.map +1 -1
- package/lib/browser/accordion/accordion.service.js +120 -33
- package/lib/browser/accordion/accordion.service.js.map +1 -1
- package/lib/browser/accordion/accordion.view.d.ts.map +1 -1
- package/lib/browser/accordion/accordion.view.js +4 -1
- package/lib/browser/accordion/accordion.view.js.map +1 -1
- package/lib/browser/accordion/section.view.d.ts.map +1 -1
- package/lib/browser/accordion/section.view.js +1 -1
- package/lib/browser/accordion/section.view.js.map +1 -1
- package/lib/browser/accordion/styles.module.less +61 -0
- package/lib/browser/command.d.ts +29 -0
- package/lib/browser/command.d.ts.map +1 -0
- package/lib/browser/command.js +84 -0
- package/lib/browser/command.js.map +1 -0
- package/lib/browser/default-config.d.ts.map +1 -1
- package/lib/browser/default-config.js +7 -6
- package/lib/browser/default-config.js.map +1 -1
- package/lib/browser/drop-area/drop-area.d.ts +3 -2
- package/lib/browser/drop-area/drop-area.d.ts.map +1 -1
- package/lib/browser/drop-area/drop-area.js +8 -5
- package/lib/browser/drop-area/drop-area.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/layout.service.d.ts +3 -0
- package/lib/browser/layout.service.d.ts.map +1 -1
- package/lib/browser/layout.service.js +120 -78
- package/lib/browser/layout.service.js.map +1 -1
- package/lib/browser/main-layout.contribution.d.ts +2 -18
- package/lib/browser/main-layout.contribution.d.ts.map +1 -1
- package/lib/browser/main-layout.contribution.js +75 -131
- package/lib/browser/main-layout.contribution.js.map +1 -1
- package/lib/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
- package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
- package/lib/browser/tabbar/bar.view.js +5 -10
- package/lib/browser/tabbar/bar.view.js.map +1 -1
- package/lib/browser/tabbar/panel.view.js +1 -1
- package/lib/browser/tabbar/panel.view.js.map +1 -1
- package/lib/browser/tabbar/renderer.view.js +4 -4
- package/lib/browser/tabbar/renderer.view.js.map +1 -1
- package/lib/browser/tabbar/tabbar-behavior-handler.d.ts +71 -0
- package/lib/browser/tabbar/tabbar-behavior-handler.d.ts.map +1 -0
- package/lib/browser/tabbar/tabbar-behavior-handler.js +210 -0
- package/lib/browser/tabbar/tabbar-behavior-handler.js.map +1 -0
- package/lib/browser/tabbar/tabbar.service.d.ts +8 -19
- package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
- package/lib/browser/tabbar/tabbar.service.js +37 -146
- package/lib/browser/tabbar/tabbar.service.js.map +1 -1
- package/lib/common/main-layout.definition.d.ts +4 -3
- package/lib/common/main-layout.definition.d.ts.map +1 -1
- package/lib/common/main-layout.definition.js +5 -4
- package/lib/common/main-layout.definition.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/accordion/accordion.service.ts +152 -35
- package/src/browser/accordion/accordion.view.tsx +4 -2
- package/src/browser/accordion/section.view.tsx +5 -1
- package/src/browser/accordion/styles.module.less +61 -0
- package/src/browser/command.ts +99 -0
- package/src/browser/default-config.ts +8 -7
- package/src/browser/drop-area/drop-area.tsx +6 -3
- package/src/browser/index.ts +1 -0
- package/src/browser/layout.service.ts +134 -66
- package/src/browser/main-layout.contribution.ts +93 -138
- package/src/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
- package/src/browser/tabbar/bar.view.tsx +9 -14
- package/src/browser/tabbar/panel.view.tsx +2 -2
- package/src/browser/tabbar/renderer.view.tsx +4 -4
- package/src/browser/tabbar/tabbar-behavior-handler.ts +260 -0
- package/src/browser/tabbar/tabbar.service.ts +52 -161
- package/src/common/main-layout.definition.ts +6 -4
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isDefined,
|
|
22
22
|
localize,
|
|
23
23
|
} from '@opensumi/ide-core-browser';
|
|
24
|
-
import { RESIZE_LOCK } from '@opensumi/ide-core-browser/lib/components';
|
|
24
|
+
import { Layout, RESIZE_LOCK } from '@opensumi/ide-core-browser/lib/components';
|
|
25
25
|
import {
|
|
26
26
|
ISplitPanelService,
|
|
27
27
|
SplitPanelManager,
|
|
@@ -85,9 +85,6 @@ export class AccordionService extends WithEventBus {
|
|
|
85
85
|
@Autowired()
|
|
86
86
|
private viewContextKeyRegistry: ViewContextKeyRegistry;
|
|
87
87
|
|
|
88
|
-
@Autowired(IMainLayoutService)
|
|
89
|
-
private readonly mainLayoutService: IMainLayoutService;
|
|
90
|
-
|
|
91
88
|
@Autowired(IContextKeyService)
|
|
92
89
|
private contextKeyService: IContextKeyService;
|
|
93
90
|
|
|
@@ -152,6 +149,15 @@ export class AccordionService extends WithEventBus {
|
|
|
152
149
|
private afterDisposeViewEmitter = this.registerDispose(new Emitter<string>());
|
|
153
150
|
public onAfterDisposeViewEvent = this.afterDisposeViewEmitter.event;
|
|
154
151
|
|
|
152
|
+
private _alignment: Layout.alignment = 'vertical';
|
|
153
|
+
|
|
154
|
+
public set alignment(alignment: Layout.alignment) {
|
|
155
|
+
if (this._alignment !== alignment) {
|
|
156
|
+
this._alignment = alignment;
|
|
157
|
+
this.doUpdateResize();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
155
161
|
constructor(public containerId: string, private noRestore?: boolean) {
|
|
156
162
|
super();
|
|
157
163
|
this.addDispose(recomputeInitiallyAndOnChange(this.visibleViews));
|
|
@@ -611,39 +617,24 @@ export class AccordionService extends WithEventBus {
|
|
|
611
617
|
const viewState = this.getViewState(viewId);
|
|
612
618
|
this.updateViewState(viewId, { ...viewState, collapsed });
|
|
613
619
|
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
// 下方视图被影响的情况下,上方视图不会同时变化,该情况会在sizeIncrement=0上体现
|
|
629
|
-
// 从视图下方最后一个展开的视图起依次减去对应的高度
|
|
630
|
-
for (let i = this.visibleViews.get().length - 1; i > index; i--) {
|
|
631
|
-
if (this.getViewState(this.visibleViews.get()[i].id).collapsed !== true) {
|
|
632
|
-
sizeIncrement = this.setSize(i, sizeIncrement, true, noAnimation);
|
|
633
|
-
} else {
|
|
634
|
-
this.setSize(i, 0, false, noAnimation);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
// 找到视图上方首个展开的视图减去对应的高度
|
|
638
|
-
for (let i = index - 1; i >= 0; i--) {
|
|
639
|
-
if ((this.state[this.visibleViews.get()[i].id] || {}).collapsed !== true) {
|
|
640
|
-
sizeIncrement = this.setSize(i, sizeIncrement, true, noAnimation);
|
|
641
|
-
} else {
|
|
642
|
-
this.setSize(i, 0, false, noAnimation);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
620
|
+
const isHorizontal = this._alignment === 'horizontal';
|
|
621
|
+
|
|
622
|
+
// 统一的尺寸计算和设置逻辑
|
|
623
|
+
let sizeIncrement: number;
|
|
624
|
+
if (collapsed) {
|
|
625
|
+
sizeIncrement = this.setSizeByAlignment(index, 0, false, noAnimation, isHorizontal);
|
|
626
|
+
} else {
|
|
627
|
+
// 仅有一个视图展开时独占
|
|
628
|
+
const targetSize =
|
|
629
|
+
this.expandedViews.length === 1
|
|
630
|
+
? this.getAvailableSizeByAlignment(isHorizontal)
|
|
631
|
+
: viewState.size || this.minSize;
|
|
632
|
+
sizeIncrement = this.setSizeByAlignment(index, targetSize, false, noAnimation, isHorizontal);
|
|
645
633
|
}
|
|
646
634
|
|
|
635
|
+
// 统一的相邻视图调整逻辑
|
|
636
|
+
this.adjustAdjacentViews(index, sizeIncrement, noAnimation, isHorizontal);
|
|
637
|
+
|
|
647
638
|
this.eventBus.fire(
|
|
648
639
|
new ViewCollapseChangedEvent({
|
|
649
640
|
viewId,
|
|
@@ -652,6 +643,49 @@ export class AccordionService extends WithEventBus {
|
|
|
652
643
|
);
|
|
653
644
|
}
|
|
654
645
|
|
|
646
|
+
private setSizeByAlignment(
|
|
647
|
+
index: number,
|
|
648
|
+
targetSize: number,
|
|
649
|
+
isIncrement?: boolean,
|
|
650
|
+
noAnimation?: boolean,
|
|
651
|
+
isHorizontal?: boolean,
|
|
652
|
+
): number {
|
|
653
|
+
return isHorizontal
|
|
654
|
+
? this.setSizeHorizontal(index, targetSize, isIncrement, noAnimation)
|
|
655
|
+
: this.setSize(index, targetSize, isIncrement, noAnimation);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
private getAvailableSizeByAlignment(isHorizontal: boolean): number {
|
|
659
|
+
return isHorizontal ? this.getAvailableSizeHorizontal() : this.getAvailableSize();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
private adjustAdjacentViews(
|
|
663
|
+
currentIndex: number,
|
|
664
|
+
sizeIncrement: number,
|
|
665
|
+
noAnimation?: boolean,
|
|
666
|
+
isHorizontal?: boolean,
|
|
667
|
+
) {
|
|
668
|
+
const visibleViews = this.visibleViews.get();
|
|
669
|
+
|
|
670
|
+
// 处理当前视图后方的视图(右侧或下方)
|
|
671
|
+
for (let i = visibleViews.length - 1; i > currentIndex; i--) {
|
|
672
|
+
if (this.getViewState(visibleViews[i].id).collapsed !== true) {
|
|
673
|
+
sizeIncrement = this.setSizeByAlignment(i, sizeIncrement, true, noAnimation, isHorizontal);
|
|
674
|
+
} else {
|
|
675
|
+
this.setSizeByAlignment(i, 0, false, noAnimation, isHorizontal);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// 处理当前视图前方的视图(左侧或上方)
|
|
680
|
+
for (let i = currentIndex - 1; i >= 0; i--) {
|
|
681
|
+
if ((this.state[visibleViews[i].id] || {}).collapsed !== true) {
|
|
682
|
+
sizeIncrement = this.setSizeByAlignment(i, sizeIncrement, true, noAnimation, isHorizontal);
|
|
683
|
+
} else {
|
|
684
|
+
this.setSizeByAlignment(i, 0, false, noAnimation, isHorizontal);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
655
689
|
protected setSize(index: number, targetSize: number, isIncrement?: boolean, noAnimation?: boolean): number {
|
|
656
690
|
const view = this.visibleViews.get()[index];
|
|
657
691
|
const fullHeight = this.splitPanelService.rootNode?.clientHeight;
|
|
@@ -725,6 +759,89 @@ export class AccordionService extends WithEventBus {
|
|
|
725
759
|
return fullHeight ? fullHeight - (this.visibleViews.get().length - 1) * this.headerSize : 0;
|
|
726
760
|
}
|
|
727
761
|
|
|
762
|
+
protected setSizeHorizontal(index: number, targetSize: number, isIncrement?: boolean, noAnimation?: boolean): number {
|
|
763
|
+
const view = this.visibleViews.get()[index];
|
|
764
|
+
const fullWidth = this.splitPanelService.rootNode?.clientWidth;
|
|
765
|
+
const panel = this.splitPanelService.panels[index];
|
|
766
|
+
|
|
767
|
+
if (!panel) {
|
|
768
|
+
return 0;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
if (!noAnimation) {
|
|
772
|
+
panel.classList.add('resize-ease-horizontal');
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
if (!targetSize && !isIncrement) {
|
|
776
|
+
targetSize = this.headerSize;
|
|
777
|
+
panel.classList.add(RESIZE_LOCK);
|
|
778
|
+
} else {
|
|
779
|
+
panel.classList.remove(RESIZE_LOCK);
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// clientWidth会被上次展开的元素挤掉
|
|
783
|
+
const prevSize = panel.clientWidth;
|
|
784
|
+
const viewState = this.getViewState(view.id);
|
|
785
|
+
let calcTargetSize: number = targetSize;
|
|
786
|
+
|
|
787
|
+
if (isIncrement) {
|
|
788
|
+
calcTargetSize = Math.max(prevSize - targetSize, this.minSize);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
if (index === this.expandedViews.length - 1 && isDefined(fullWidth)) {
|
|
792
|
+
// 最后一个视图需要兼容最大宽度超出总视图宽度及最大宽度不足总视图宽度的情况
|
|
793
|
+
if (calcTargetSize + index * this.minSize > fullWidth) {
|
|
794
|
+
calcTargetSize -= calcTargetSize + index * this.minSize - fullWidth;
|
|
795
|
+
} else {
|
|
796
|
+
const restSize = this.getPanelFullWidthHorizontal(view.id);
|
|
797
|
+
if (calcTargetSize + restSize < fullWidth) {
|
|
798
|
+
calcTargetSize += fullWidth - (calcTargetSize + restSize);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
if (this.rendered) {
|
|
804
|
+
let toSaveSize: number;
|
|
805
|
+
if (targetSize === this.headerSize) {
|
|
806
|
+
// 当前视图即将折叠且不是唯一展开的视图时,存储当前宽度
|
|
807
|
+
toSaveSize = prevSize;
|
|
808
|
+
} else {
|
|
809
|
+
toSaveSize = calcTargetSize;
|
|
810
|
+
}
|
|
811
|
+
if (toSaveSize !== this.headerSize) {
|
|
812
|
+
// 视图折叠宽度不做存储
|
|
813
|
+
viewState.size = toSaveSize;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
this.storeState();
|
|
818
|
+
viewState.nextSize = calcTargetSize;
|
|
819
|
+
|
|
820
|
+
if (!noAnimation) {
|
|
821
|
+
setTimeout(() => {
|
|
822
|
+
// 动画 0.1s,保证结束后移除
|
|
823
|
+
panel.classList.remove('resize-ease-horizontal');
|
|
824
|
+
}, 200);
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return isIncrement ? calcTargetSize - (prevSize - targetSize) : targetSize - prevSize;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
protected getAvailableSizeHorizontal() {
|
|
831
|
+
const fullWidth = this.splitPanelService.rootNode?.clientWidth;
|
|
832
|
+
return fullWidth ? fullWidth - (this.visibleViews.get().length - 1) * this.headerSize : 0;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
private getPanelFullWidthHorizontal(ignoreViewId?: string) {
|
|
836
|
+
return Object.keys(this.state)
|
|
837
|
+
.filter((viewId) => this.views.find((item) => item.id === viewId) && viewId !== ignoreViewId)
|
|
838
|
+
.reduce(
|
|
839
|
+
(acc, id) =>
|
|
840
|
+
acc + (this.state[id].collapsed ? this.headerSize : this.state[id].hidden ? 0 : this.state[id].size!),
|
|
841
|
+
0,
|
|
842
|
+
);
|
|
843
|
+
}
|
|
844
|
+
|
|
728
845
|
private handleContextKeyChange() {
|
|
729
846
|
Array.from(this.viewsWithContextKey.values()).forEach((view) => {
|
|
730
847
|
if (
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import cls from 'classnames';
|
|
1
2
|
import React, { useMemo } from 'react';
|
|
2
3
|
|
|
3
4
|
import { View, useAutorun, useInjectable } from '@opensumi/ide-core-browser';
|
|
@@ -33,6 +34,7 @@ export const AccordionContainer = ({
|
|
|
33
34
|
const layoutViewSize = useInjectable<LayoutViewSizeConfig>(LayoutViewSizeConfig);
|
|
34
35
|
|
|
35
36
|
const accordionService: AccordionService = useInjectable(AccordionServiceFactory)(containerId, noRestore);
|
|
37
|
+
accordionService.alignment = alignment;
|
|
36
38
|
const visibleViews = useAutorun(accordionService.visibleViews);
|
|
37
39
|
|
|
38
40
|
useAutorun(accordionService.stateObservable);
|
|
@@ -52,10 +54,10 @@ export const AccordionContainer = ({
|
|
|
52
54
|
React.useEffect(() => {
|
|
53
55
|
accordionService.initConfig({ headerSize: layoutHeaderSize, minSize });
|
|
54
56
|
}, []);
|
|
55
|
-
|
|
57
|
+
// FIXME: accordion 的 resize event 失效了
|
|
56
58
|
return (
|
|
57
59
|
<SplitPanel
|
|
58
|
-
className={className}
|
|
60
|
+
className={cls(className, { horizontal: alignment === 'horizontal' })}
|
|
59
61
|
style={style}
|
|
60
62
|
headerSize={headerSize}
|
|
61
63
|
dynamicTarget={true}
|
|
@@ -169,7 +169,11 @@ export const AccordionSection = ({
|
|
|
169
169
|
}, [expanded, headerSize, alignment]);
|
|
170
170
|
|
|
171
171
|
return (
|
|
172
|
-
<div
|
|
172
|
+
<div
|
|
173
|
+
className={cls(styles_kt_split_panel, { horizontal: alignment === 'horizontal' })}
|
|
174
|
+
data-view-id={viewId}
|
|
175
|
+
draggable={false}
|
|
176
|
+
>
|
|
173
177
|
{!noHeader && (
|
|
174
178
|
<div
|
|
175
179
|
{...attrs}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
.resize-ease {
|
|
3
3
|
transition: height 0.1s ease-out;
|
|
4
4
|
}
|
|
5
|
+
.resize-ease-horizontal {
|
|
6
|
+
transition: width 0.1s ease-out;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
.kt_split_panel_container {
|
|
@@ -10,6 +13,10 @@
|
|
|
10
13
|
height: 100%;
|
|
11
14
|
white-space: nowrap;
|
|
12
15
|
flex-direction: column;
|
|
16
|
+
|
|
17
|
+
&.horizontal {
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
}
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
.kt_split_panel {
|
|
@@ -19,6 +26,14 @@
|
|
|
19
26
|
display: flex;
|
|
20
27
|
flex-direction: column;
|
|
21
28
|
position: relative;
|
|
29
|
+
|
|
30
|
+
&.horizontal {
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
width: auto;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
&:hover .actions_wrap {
|
|
23
38
|
display: block;
|
|
24
39
|
}
|
|
@@ -224,3 +239,49 @@
|
|
|
224
239
|
}
|
|
225
240
|
}
|
|
226
241
|
}
|
|
242
|
+
|
|
243
|
+
// 水平模式样式支持
|
|
244
|
+
.kt_split_panel.horizontal {
|
|
245
|
+
.kt_split_panel_header {
|
|
246
|
+
writing-mode: vertical-lr;
|
|
247
|
+
text-orientation: mixed;
|
|
248
|
+
border-top: 1px solid transparent;
|
|
249
|
+
border-left: 1px solid var(--sideBar-border);
|
|
250
|
+
flex-direction: column;
|
|
251
|
+
width: 100%;
|
|
252
|
+
height: auto;
|
|
253
|
+
justify-content: flex-start;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.label_wrap {
|
|
257
|
+
flex-direction: column;
|
|
258
|
+
align-items: flex-start;
|
|
259
|
+
width: 100%;
|
|
260
|
+
|
|
261
|
+
i.arrow_icon {
|
|
262
|
+
margin: 4px 0;
|
|
263
|
+
&.kt_mod_collapsed {
|
|
264
|
+
transform: rotate(-180deg);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.section_label {
|
|
270
|
+
writing-mode: vertical-lr;
|
|
271
|
+
text-orientation: mixed;
|
|
272
|
+
line-height: normal;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.section_description {
|
|
276
|
+
writing-mode: vertical-lr;
|
|
277
|
+
text-orientation: mixed;
|
|
278
|
+
margin-left: 0;
|
|
279
|
+
margin-top: 10px;
|
|
280
|
+
line-height: normal;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.section_badge {
|
|
284
|
+
margin-left: 0;
|
|
285
|
+
margin-top: 6px;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Command, getIcon } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { MenuCommandDesc } from '@opensumi/ide-core-browser/lib/menu/next';
|
|
3
|
+
|
|
4
|
+
/** @deprecated 请使用 main-layout.view.toggle */
|
|
5
|
+
export const TOGGLE_LEFT_PANEL_COMMAND: Command = {
|
|
6
|
+
id: 'main-layout.left-panel.toggle',
|
|
7
|
+
delegate: 'main-layout.view.toggle',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/** @deprecated 请使用 main-layout.extendView.toggle */
|
|
11
|
+
export const TOGGLE_RIGHT_PANEL_COMMAND: Command = {
|
|
12
|
+
id: 'main-layout.right-panel.toggle',
|
|
13
|
+
delegate: 'main-layout.extend-view.toggle',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @deprecated 请使用 main-layout.panel.toggle */
|
|
17
|
+
export const TOGGLE_BOTTOM_PANEL_COMMAND: Command = {
|
|
18
|
+
id: 'main-layout.bottom-panel.toggle',
|
|
19
|
+
delegate: 'main-layout.panel.toggle',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @deprecated 请使用 main-layout.panel.is-visible */
|
|
23
|
+
export const IS_VISIBLE_BOTTOM_PANEL_COMMAND: Command = {
|
|
24
|
+
id: 'main-layout.bottom-panel.is-visible',
|
|
25
|
+
delegate: 'main-layout.panel.is-visible',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @deprecated 请使用 main-layout.view.is-visible */
|
|
29
|
+
export const IS_VISIBLE_LEFT_PANEL_COMMAND: Command = {
|
|
30
|
+
id: 'main-layout.left-panel.is-visible',
|
|
31
|
+
delegate: 'main-layout.view.is-visible',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @deprecated 请使用 main-layout.extend-view.is-visible */
|
|
35
|
+
export const IS_VISIBLE_RIGHT_PANEL_COMMAND: Command = {
|
|
36
|
+
id: 'main-layout.right-panel.is-visible',
|
|
37
|
+
delegate: 'main-layout.extend-view.is-visible',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** @deprecated 请使用 main-layout.panel.expand */
|
|
41
|
+
export const EXPAND_BOTTOM_PANEL: Command = {
|
|
42
|
+
id: 'main-layout.bottom-panel.expand',
|
|
43
|
+
delegate: 'main-layout.panel.expand',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @deprecated 请使用 main-layout.panel.retract */
|
|
47
|
+
export const RETRACT_BOTTOM_PANEL: Command = {
|
|
48
|
+
id: 'main-layout.bottom-panel.retract',
|
|
49
|
+
delegate: 'main-layout.panel.retract',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const WORKBENCH_ACTION_CLOSESIDECAR: Command = {
|
|
53
|
+
id: 'workbench.action.closeSidebar',
|
|
54
|
+
label: '%main-layout.sidebar.hide%',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WORKBENCH_ACTION_CLOSEPANEL: Command = {
|
|
58
|
+
id: 'workbench.action.closePanel',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const TOGGLE_VIEW_COMMAND: MenuCommandDesc = {
|
|
62
|
+
id: 'main-layout.view.toggle',
|
|
63
|
+
label: '%main-layout.view.toggle%',
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const TOGGLE_EXTEND_VIEW_COMMAND: MenuCommandDesc = {
|
|
67
|
+
id: 'main-layout.extend-view.toggle',
|
|
68
|
+
label: '%main-layout.extend-view.toggle%',
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const TOGGLE_PANEL_COMMAND: Command = {
|
|
72
|
+
id: 'main-layout.panel.toggle',
|
|
73
|
+
iconClass: getIcon('minus'),
|
|
74
|
+
label: '%main-layout.panel.toggle%',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const IS_VISIBLE_VIEW_COMMAND: Command = {
|
|
78
|
+
id: 'main-layout.view.is-visible',
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const IS_VISIBLE_EXTEND_VIEW_COMMAND: Command = {
|
|
82
|
+
id: 'main-layout.extend-view.is-visible',
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const IS_VISIBLE_PANEL_COMMAND: Command = {
|
|
86
|
+
id: 'main-layout.panel.is-visible',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const EXPAND_PANEL_COMMAND: Command = {
|
|
90
|
+
id: 'main-layout.panel.expand',
|
|
91
|
+
label: '%layout.tabbar.expand%',
|
|
92
|
+
iconClass: getIcon('expand'),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const RETRACT_PANEL_COMMAND: Command = {
|
|
96
|
+
id: 'main-layout.panel.retract',
|
|
97
|
+
label: '%layout.tabbar.retract%',
|
|
98
|
+
iconClass: getIcon('shrink'),
|
|
99
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
import { LayoutConfig, SlotLocation } from '@opensumi/ide-core-browser';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { DROP_EXTEND_VIEW_CONTAINER, DROP_PANEL_CONTAINER, DROP_VIEW_CONTAINER } from '../common';
|
|
5
5
|
|
|
6
6
|
export const defaultConfig: LayoutConfig = {
|
|
7
7
|
[SlotLocation.top]: {
|
|
@@ -10,25 +10,26 @@ export const defaultConfig: LayoutConfig = {
|
|
|
10
10
|
[SlotLocation.action]: {
|
|
11
11
|
modules: ['@opensumi/ide-toolbar-action'],
|
|
12
12
|
},
|
|
13
|
-
[SlotLocation.
|
|
13
|
+
[SlotLocation.view]: {
|
|
14
14
|
modules: [
|
|
15
|
+
DROP_VIEW_CONTAINER,
|
|
15
16
|
'@opensumi/ide-explorer',
|
|
16
17
|
'@opensumi/ide-search',
|
|
17
18
|
'@opensumi/ide-scm',
|
|
18
|
-
'@opensumi/ide-extension-manager',
|
|
19
19
|
'@opensumi/ide-debug',
|
|
20
|
+
'@opensumi/ide-extension-manager',
|
|
20
21
|
'@opensumi/ide-notebook',
|
|
21
22
|
],
|
|
22
23
|
},
|
|
23
|
-
[SlotLocation.
|
|
24
|
-
modules: [
|
|
24
|
+
[SlotLocation.extendView]: {
|
|
25
|
+
modules: [DROP_EXTEND_VIEW_CONTAINER],
|
|
25
26
|
},
|
|
26
27
|
[SlotLocation.main]: {
|
|
27
28
|
modules: ['@opensumi/ide-editor'],
|
|
28
29
|
},
|
|
29
|
-
[SlotLocation.
|
|
30
|
+
[SlotLocation.panel]: {
|
|
30
31
|
modules: [
|
|
31
|
-
|
|
32
|
+
DROP_PANEL_CONTAINER,
|
|
32
33
|
'@opensumi/ide-terminal-next',
|
|
33
34
|
'@opensumi/ide-output',
|
|
34
35
|
'debug-console',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { localize, useInjectable } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { SlotLocation, localize, useInjectable } from '@opensumi/ide-core-browser';
|
|
4
4
|
|
|
5
5
|
import { IMainLayoutService } from '../../common';
|
|
6
6
|
|
|
@@ -18,6 +18,7 @@ const DropArea: React.FC<IDropAreaProps> = (props) => {
|
|
|
18
18
|
(e: React.DragEvent) => {
|
|
19
19
|
const containerId = e.dataTransfer?.getData('containerId');
|
|
20
20
|
layoutService.moveContainerTo(containerId, location);
|
|
21
|
+
layoutService.hideDropArea();
|
|
21
22
|
},
|
|
22
23
|
[layoutService, location],
|
|
23
24
|
);
|
|
@@ -35,6 +36,8 @@ const DropArea: React.FC<IDropAreaProps> = (props) => {
|
|
|
35
36
|
);
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
export const
|
|
39
|
+
export const ViewDropArea = () => <DropArea location={SlotLocation.view} />;
|
|
39
40
|
|
|
40
|
-
export const
|
|
41
|
+
export const ExtendViewDropArea = () => <DropArea location={SlotLocation.extendView} />;
|
|
42
|
+
|
|
43
|
+
export const PanelDropArea = () => <DropArea location={SlotLocation.panel} />;
|
package/src/browser/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Injectable, Injector, Provider } from '@opensumi/di';
|
|
2
2
|
import { BrowserModule } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { Layout } from '@opensumi/ide-core-browser/lib/components';
|
|
3
4
|
|
|
4
5
|
import { IMainLayoutService, IViewsRegistry, MainLayoutContribution } from '../common';
|
|
5
6
|
|