@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.
Files changed (71) hide show
  1. package/README.md +30 -31
  2. package/lib/browser/accordion/accordion.service.d.ts +9 -1
  3. package/lib/browser/accordion/accordion.service.d.ts.map +1 -1
  4. package/lib/browser/accordion/accordion.service.js +120 -33
  5. package/lib/browser/accordion/accordion.service.js.map +1 -1
  6. package/lib/browser/accordion/accordion.view.d.ts.map +1 -1
  7. package/lib/browser/accordion/accordion.view.js +4 -1
  8. package/lib/browser/accordion/accordion.view.js.map +1 -1
  9. package/lib/browser/accordion/section.view.d.ts.map +1 -1
  10. package/lib/browser/accordion/section.view.js +1 -1
  11. package/lib/browser/accordion/section.view.js.map +1 -1
  12. package/lib/browser/accordion/styles.module.less +61 -0
  13. package/lib/browser/command.d.ts +29 -0
  14. package/lib/browser/command.d.ts.map +1 -0
  15. package/lib/browser/command.js +84 -0
  16. package/lib/browser/command.js.map +1 -0
  17. package/lib/browser/default-config.d.ts.map +1 -1
  18. package/lib/browser/default-config.js +7 -6
  19. package/lib/browser/default-config.js.map +1 -1
  20. package/lib/browser/drop-area/drop-area.d.ts +3 -2
  21. package/lib/browser/drop-area/drop-area.d.ts.map +1 -1
  22. package/lib/browser/drop-area/drop-area.js +8 -5
  23. package/lib/browser/drop-area/drop-area.js.map +1 -1
  24. package/lib/browser/index.d.ts.map +1 -1
  25. package/lib/browser/index.js.map +1 -1
  26. package/lib/browser/layout.service.d.ts +3 -0
  27. package/lib/browser/layout.service.d.ts.map +1 -1
  28. package/lib/browser/layout.service.js +120 -78
  29. package/lib/browser/layout.service.js.map +1 -1
  30. package/lib/browser/main-layout.contribution.d.ts +2 -18
  31. package/lib/browser/main-layout.contribution.d.ts.map +1 -1
  32. package/lib/browser/main-layout.contribution.js +75 -131
  33. package/lib/browser/main-layout.contribution.js.map +1 -1
  34. package/lib/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
  35. package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
  36. package/lib/browser/tabbar/bar.view.js +5 -10
  37. package/lib/browser/tabbar/bar.view.js.map +1 -1
  38. package/lib/browser/tabbar/panel.view.js +1 -1
  39. package/lib/browser/tabbar/panel.view.js.map +1 -1
  40. package/lib/browser/tabbar/renderer.view.js +4 -4
  41. package/lib/browser/tabbar/renderer.view.js.map +1 -1
  42. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts +71 -0
  43. package/lib/browser/tabbar/tabbar-behavior-handler.d.ts.map +1 -0
  44. package/lib/browser/tabbar/tabbar-behavior-handler.js +210 -0
  45. package/lib/browser/tabbar/tabbar-behavior-handler.js.map +1 -0
  46. package/lib/browser/tabbar/tabbar.service.d.ts +8 -19
  47. package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
  48. package/lib/browser/tabbar/tabbar.service.js +37 -146
  49. package/lib/browser/tabbar/tabbar.service.js.map +1 -1
  50. package/lib/common/main-layout.definition.d.ts +4 -3
  51. package/lib/common/main-layout.definition.d.ts.map +1 -1
  52. package/lib/common/main-layout.definition.js +5 -4
  53. package/lib/common/main-layout.definition.js.map +1 -1
  54. package/package.json +8 -8
  55. package/src/browser/accordion/accordion.service.ts +152 -35
  56. package/src/browser/accordion/accordion.view.tsx +4 -2
  57. package/src/browser/accordion/section.view.tsx +5 -1
  58. package/src/browser/accordion/styles.module.less +61 -0
  59. package/src/browser/command.ts +99 -0
  60. package/src/browser/default-config.ts +8 -7
  61. package/src/browser/drop-area/drop-area.tsx +6 -3
  62. package/src/browser/index.ts +1 -0
  63. package/src/browser/layout.service.ts +134 -66
  64. package/src/browser/main-layout.contribution.ts +93 -138
  65. package/src/browser/tabbar/TABBAR_CONFIG_USAGE.md +141 -0
  66. package/src/browser/tabbar/bar.view.tsx +9 -14
  67. package/src/browser/tabbar/panel.view.tsx +2 -2
  68. package/src/browser/tabbar/renderer.view.tsx +4 -4
  69. package/src/browser/tabbar/tabbar-behavior-handler.ts +260 -0
  70. package/src/browser/tabbar/tabbar.service.ts +52 -161
  71. package/src/common/main-layout.definition.ts +6 -4
@@ -18,7 +18,7 @@ import {
18
18
  WithEventBus,
19
19
  slotRendererRegistry,
20
20
  } from '@opensumi/ide-core-browser';
21
- import { fixLayout } from '@opensumi/ide-core-browser/lib/components';
21
+ import { Layout, fixLayout } from '@opensumi/ide-core-browser/lib/components';
22
22
  import { LAYOUT_STATE, LayoutState } from '@opensumi/ide-core-browser/lib/layout/layout-state';
23
23
  import { ComponentRegistryInfo } from '@opensumi/ide-core-browser/lib/layout/layout.interface';
24
24
  import {
@@ -29,11 +29,13 @@ import {
29
29
  MenuId,
30
30
  } from '@opensumi/ide-core-browser/lib/menu/next';
31
31
  import { Deferred, getDebugLogger, isUndefined } from '@opensumi/ide-core-common';
32
+ import { transaction } from '@opensumi/ide-monaco/lib/common/observable';
32
33
  import { ThemeChangedEvent } from '@opensumi/ide-theme';
33
34
 
34
35
  import {
35
- DROP_BOTTOM_CONTAINER,
36
- DROP_RIGHT_CONTAINER,
36
+ DROP_EXTEND_VIEW_CONTAINER,
37
+ DROP_PANEL_CONTAINER,
38
+ DROP_VIEW_CONTAINER,
37
39
  IMainLayoutService,
38
40
  MainLayoutContribution,
39
41
  SUPPORT_ACCORDION_LOCATION,
@@ -45,19 +47,21 @@ import { TabbarService } from './tabbar/tabbar.service';
45
47
  import { TabBarHandler } from './tabbar-handler';
46
48
 
47
49
  const defaultLayoutState = {
48
- [SlotLocation.left]: {
50
+ [SlotLocation.view]: {
49
51
  currentId: undefined,
50
52
  size: undefined,
51
53
  },
52
- [SlotLocation.right]: {
54
+ [SlotLocation.extendView]: {
53
55
  // 依照下面的恢复逻辑,这里设置为 `''` 时,就不会恢复右侧的 TabBar 的状态(即选中相应的 viewContainer)
54
56
  currentId: '',
55
57
  size: undefined,
56
58
  },
57
- [SlotLocation.bottom]: {
59
+ [SlotLocation.panel]: {
58
60
  currentId: undefined,
59
61
  size: undefined,
60
62
  },
63
+ // 存储 Container 的移动信息:containerId -> location
64
+ containerLocations: {},
61
65
  };
62
66
 
63
67
  @Injectable()
@@ -154,6 +158,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
154
158
  currentId,
155
159
  size: service.prevSize,
156
160
  };
161
+
157
162
  this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
158
163
  }
159
164
 
@@ -174,63 +179,86 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
174
179
 
175
180
  restoreTabbarService = async (service: TabbarService) => {
176
181
  this.state = fixLayout(this.layoutState.getState(LAYOUT_STATE.MAIN, defaultLayoutState));
177
-
178
182
  const { currentId, size } = this.state[service.location] || {};
179
183
  service.prevSize = size;
180
- let defaultContainer = service.visibleContainers[0] && service.visibleContainers[0].options!.containerId;
181
- const defaultPanels = this.appConfig.defaultPanels;
182
- const restorePanel = defaultPanels && defaultPanels[service.location];
183
- if (defaultPanels && restorePanel !== undefined) {
184
- if (restorePanel) {
185
- if (service.containersMap.has(restorePanel)) {
186
- defaultContainer = restorePanel;
187
- } else {
188
- const componentInfo = this.componentRegistry.getComponentRegistryInfo(restorePanel);
189
- if (
190
- componentInfo &&
191
- this.appConfig.layoutConfig[service.location]?.modules &&
192
- ~this.appConfig.layoutConfig[service.location].modules.indexOf(restorePanel)
193
- ) {
194
- defaultContainer = componentInfo.options!.containerId;
184
+
185
+ // 根据存储的容器位置信息恢复容器位置(drag & drop 移动过的)
186
+ if (this.state.containerLocations) {
187
+ for (const [containerId, targetLocation] of Object.entries(this.state.containerLocations)) {
188
+ if (targetLocation === service.location && !this.isDropContainer(containerId)) {
189
+ // 检查容器是否在其他 tabbar 中,如果是则移动到当前 tabbar
190
+ const expectTabbar = this.findTabbarServiceByContainerId(containerId);
191
+ if (expectTabbar && expectTabbar.location !== service.location) {
192
+ this.moveContainerTo(containerId, service.location);
195
193
  } else {
196
- this.logger.warn(`[defaultPanels] No \`${restorePanel}\` view found!`);
194
+ // 清理无用的状态
195
+ delete this.state.containerLocations[containerId];
196
+ this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
197
197
  }
198
198
  }
199
- } else {
200
- defaultContainer = '';
201
199
  }
202
200
  }
203
- /**
204
- * ContainerId 存在三种值类型,对应的处理模式如下:
205
- * 1. undefined: 采用首个注册的容器作为当前 containerId
206
- * 2. string: 非 drop container 直接使用该 containerId 作为当前 containerId
207
- * 3. '': 直接清空当前 containerId,不展开相应的 viewContainer
208
- */
201
+
202
+ const defaultContainer = this.getDefaultContainer(service);
203
+ this.restoreContainerId(service, currentId, defaultContainer);
204
+ };
205
+
206
+ private getDefaultContainer(service: TabbarService): string | undefined {
207
+ const defaultPanels = this.appConfig.defaultPanels;
208
+ const defaultPanel = defaultPanels && defaultPanels[service.location];
209
+
210
+ // 如果配置了默认面板,则使用配置的面板
211
+ if (defaultPanels && defaultPanel !== undefined) {
212
+ if (service.containersMap.has(defaultPanel)) {
213
+ return defaultPanel;
214
+ }
215
+
216
+ const componentInfo = this.componentRegistry.getComponentRegistryInfo(defaultPanel);
217
+ const isValidModule =
218
+ componentInfo && this.appConfig.layoutConfig[service.location]?.modules?.includes(defaultPanel);
219
+
220
+ if (isValidModule) {
221
+ return componentInfo.options!.containerId;
222
+ }
223
+
224
+ this.logger.warn(`[defaultPanels] No \`${defaultPanel}\` view found!`);
225
+ }
226
+
227
+ // 获取第一个可见容器作为默认值
228
+ return service.visibleContainers[0]?.options?.containerId;
229
+ }
230
+
231
+ private restoreContainerId(
232
+ service: TabbarService,
233
+ currentId: string | undefined,
234
+ defaultContainer: string | undefined,
235
+ ) {
209
236
  if (isUndefined(currentId)) {
237
+ // 未指定 currentId 时,使用默认容器或第一个注册的容器
210
238
  if (isUndefined(defaultContainer)) {
211
- // 默认采用首个注册的容器作为当前 containerId
212
239
  service.updateNextContainerId();
213
240
  } else {
214
241
  service.updateCurrentContainerId(defaultContainer);
215
242
  }
216
- } else if (currentId && !this.isDropContainer(currentId)) {
243
+ return;
244
+ }
245
+
246
+ if (currentId && !this.isDropContainer(currentId)) {
217
247
  if (service.containersMap.has(currentId)) {
218
248
  service.updateCurrentContainerId(currentId);
219
- } else {
220
- // 如果在别的 tabbar 中存在该 containerId,则将其移动到当前 tabbar
221
- if (this.findTabbarServiceByContainerId(currentId)) {
222
- this.moveContainerTo(currentId, service.location);
223
- service.updateCurrentContainerId(currentId);
224
- } else {
225
- service.updateCurrentContainerId(defaultContainer);
226
- // 等待后续新容器注册时,更新当前的 containerId
227
- service.updateNextContainerId(currentId);
228
- }
249
+ return;
229
250
  }
230
- } else if (currentId === '' || this.isDropContainer(currentId)) {
251
+
252
+ // 如果当前 containerId 不存在,则使用默认容器
253
+ service.updateCurrentContainerId(defaultContainer || '');
254
+ service.updateNextContainerId(currentId);
255
+ return;
256
+ }
257
+
258
+ if (currentId === '' || this.isDropContainer(currentId)) {
231
259
  service.updateCurrentContainerId('');
232
260
  }
233
- };
261
+ }
234
262
 
235
263
  findTabbarServiceByContainerId(containerId: string): TabbarService | undefined {
236
264
  let tabbarService: undefined | TabbarService;
@@ -256,7 +284,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
256
284
  this.logger.error(`cannot find container: ${containerId}`);
257
285
  return;
258
286
  }
259
- if (!container.options?.draggable) {
287
+ if (container.options?.draggable === false) {
260
288
  this.logger.warn(`container: ${containerId} is not draggable`);
261
289
  return;
262
290
  }
@@ -271,33 +299,59 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
271
299
  toTabbar.dynamicAddContainer(containerId, container);
272
300
  const newHandler = this.injector.get(TabBarHandler, [containerId, this.getTabbarService(toTabbar.location)]);
273
301
  this.handleMap.set(containerId, newHandler!);
302
+
303
+ // 更新容器位置信息
304
+ if (!this.state.containerLocations) {
305
+ this.state.containerLocations = {};
306
+ }
307
+ this.state.containerLocations[containerId] = to;
308
+ // this.layoutState.setState(LAYOUT_STATE.MAIN, this.state);
274
309
  }
275
310
 
276
311
  showDropAreaForContainer(containerId: string): void {
277
312
  const tabbarService = this.findTabbarServiceByContainerId(containerId);
278
- const bottomService = this.tabbarServices.get('bottom');
279
- const rightService = this.tabbarServices.get('right');
313
+ const panelService = this.tabbarServices.get(SlotLocation.panel);
314
+ const extendViewService = this.tabbarServices.get(SlotLocation.extendView);
315
+ const viewService = this.tabbarServices.get(SlotLocation.view);
280
316
  if (!tabbarService) {
281
317
  this.logger.error(`cannot find container: ${containerId}`);
282
318
  return;
283
319
  }
284
- if (tabbarService?.location === 'right') {
285
- bottomService?.updateCurrentContainerId(DROP_BOTTOM_CONTAINER);
286
- }
287
- if (tabbarService?.location === 'bottom') {
288
- rightService?.updateCurrentContainerId(DROP_RIGHT_CONTAINER);
289
- }
320
+ const otherServices = {
321
+ [SlotLocation.extendView]: [panelService, viewService],
322
+ [SlotLocation.panel]: [extendViewService, viewService],
323
+ [SlotLocation.view]: [panelService, extendViewService],
324
+ };
325
+
326
+ const dropContainers = {
327
+ [SlotLocation.panel]: DROP_PANEL_CONTAINER,
328
+ [SlotLocation.extendView]: DROP_EXTEND_VIEW_CONTAINER,
329
+ [SlotLocation.view]: DROP_VIEW_CONTAINER,
330
+ };
331
+
332
+ transaction((tx) => {
333
+ otherServices[tabbarService?.location]?.forEach((service) => {
334
+ service?.updateCurrentContainerId(dropContainers[service?.location], tx);
335
+ });
336
+ });
290
337
  }
291
338
 
292
339
  hideDropArea(): void {
293
- const bottomService = this.tabbarServices.get('bottom');
294
- const rightService = this.tabbarServices.get('right');
295
- if (bottomService?.currentContainerId.get() === DROP_BOTTOM_CONTAINER) {
296
- bottomService.updateCurrentContainerId(bottomService.previousContainerId || '');
297
- }
298
- if (rightService?.currentContainerId.get() === DROP_RIGHT_CONTAINER) {
299
- rightService.updateCurrentContainerId(rightService.previousContainerId || '');
300
- }
340
+ const panelService = this.tabbarServices.get(SlotLocation.panel);
341
+ const extendViewService = this.tabbarServices.get(SlotLocation.extendView);
342
+ const viewService = this.tabbarServices.get(SlotLocation.view);
343
+
344
+ transaction((tx) => {
345
+ if (panelService?.currentContainerId.get() === DROP_PANEL_CONTAINER) {
346
+ panelService.updateCurrentContainerId(panelService.previousContainerId || '', tx);
347
+ }
348
+ if (extendViewService?.currentContainerId.get() === DROP_EXTEND_VIEW_CONTAINER) {
349
+ extendViewService.updateCurrentContainerId(extendViewService.previousContainerId || '', tx);
350
+ }
351
+ if (viewService?.currentContainerId.get() === DROP_VIEW_CONTAINER) {
352
+ viewService.updateCurrentContainerId(viewService.previousContainerId || '', tx);
353
+ }
354
+ });
301
355
  }
302
356
 
303
357
  isVisible(location: string) {
@@ -336,7 +390,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
336
390
  }
337
391
 
338
392
  private isDropContainer(containerId: string): boolean {
339
- return [DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER].includes(containerId);
393
+ return [DROP_PANEL_CONTAINER, DROP_EXTEND_VIEW_CONTAINER, DROP_VIEW_CONTAINER].includes(containerId);
340
394
  }
341
395
 
342
396
  private findNonDropContainerId(tabbarService: TabbarService): string {
@@ -382,7 +436,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
382
436
  });
383
437
  const debouncedStoreState = debounce(() => this.storeState(service, service.currentContainerId.get()), 100);
384
438
  service.addDispose(service.onSizeChange(debouncedStoreState));
385
- if (location === SlotLocation.bottom) {
439
+ if (location === SlotLocation.panel) {
386
440
  // use this getter's side effect to set bottomExpanded contextKey
387
441
  const debouncedUpdate = debounce(() => void this.bottomExpanded, 100);
388
442
  service.addDispose(service.onSizeChange(() => debouncedUpdate));
@@ -463,6 +517,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
463
517
  if (Fc) {
464
518
  this.debug.warn('collectTabbarComponent api warning: Please move react component into options.component!');
465
519
  }
520
+ side = this.mapSideToLocation(side);
466
521
  if (options.hideIfEmpty && !views.length && !options.component) {
467
522
  this.holdTabbarComponent.set(options.containerId, { views, options, side });
468
523
  if (this.tabbarUpdateSet.has(options.containerId)) {
@@ -495,6 +550,19 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
495
550
  return options.containerId;
496
551
  }
497
552
 
553
+ private mapSideToLocation(side: string): SlotLocation {
554
+ switch (side) {
555
+ case 'left':
556
+ return SlotLocation.view;
557
+ case 'right':
558
+ return SlotLocation.extendView;
559
+ case 'bottom':
560
+ return SlotLocation.panel;
561
+ default:
562
+ return side;
563
+ }
564
+ }
565
+
498
566
  getViewAccordionService(viewId: string) {
499
567
  const containerId = this.viewToContainerMap.get(viewId);
500
568
  if (!containerId) {
@@ -640,7 +708,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
640
708
 
641
709
  // TODO 这样很耦合,不能做到tab renderer自由拆分
642
710
  expandBottom(expand: boolean): void {
643
- const tabbarService = this.getTabbarService(SlotLocation.bottom);
711
+ const tabbarService = this.getTabbarService(SlotLocation.panel);
644
712
  if (!tabbarService.currentContainerId.get()) {
645
713
  tabbarService.updateCurrentContainerId(
646
714
  tabbarService.currentContainerId.get() ||
@@ -653,7 +721,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
653
721
  }
654
722
 
655
723
  get bottomExpanded(): boolean {
656
- const tabbarService = this.getTabbarService(SlotLocation.bottom);
724
+ const tabbarService = this.getTabbarService(SlotLocation.panel);
657
725
  this.contextKeyService.createKey('bottomFullExpanded', tabbarService.isExpanded);
658
726
  return tabbarService.isExpanded;
659
727
  }
@@ -39,85 +39,34 @@ import {
39
39
  MenuId,
40
40
  } from '@opensumi/ide-core-browser/lib/menu/next';
41
41
  import { ContributionProvider, Domain, IEventBus, WithEventBus, localize } from '@opensumi/ide-core-common';
42
- import { Command, CommandContribution, CommandRegistry, CommandService } from '@opensumi/ide-core-common/lib/command';
42
+ import { CommandContribution, CommandRegistry, CommandService } from '@opensumi/ide-core-common/lib/command';
43
43
 
44
- import { DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER, IMainLayoutService } from '../common';
44
+ import { DROP_EXTEND_VIEW_CONTAINER, DROP_PANEL_CONTAINER, DROP_VIEW_CONTAINER, IMainLayoutService } from '../common';
45
45
 
46
- import { BottomDropArea, RightDropArea } from './drop-area/drop-area';
46
+ import {
47
+ EXPAND_BOTTOM_PANEL,
48
+ EXPAND_PANEL_COMMAND,
49
+ IS_VISIBLE_BOTTOM_PANEL_COMMAND,
50
+ IS_VISIBLE_EXTEND_VIEW_COMMAND,
51
+ IS_VISIBLE_LEFT_PANEL_COMMAND,
52
+ IS_VISIBLE_PANEL_COMMAND,
53
+ IS_VISIBLE_RIGHT_PANEL_COMMAND,
54
+ IS_VISIBLE_VIEW_COMMAND,
55
+ RETRACT_BOTTOM_PANEL,
56
+ RETRACT_PANEL_COMMAND,
57
+ TOGGLE_BOTTOM_PANEL_COMMAND,
58
+ TOGGLE_EXTEND_VIEW_COMMAND,
59
+ TOGGLE_LEFT_PANEL_COMMAND,
60
+ TOGGLE_PANEL_COMMAND,
61
+ TOGGLE_RIGHT_PANEL_COMMAND,
62
+ TOGGLE_VIEW_COMMAND,
63
+ WORKBENCH_ACTION_CLOSEPANEL,
64
+ WORKBENCH_ACTION_CLOSESIDECAR,
65
+ } from './command';
66
+ import { ExtendViewDropArea, PanelDropArea, ViewDropArea } from './drop-area/drop-area';
47
67
  import { ViewQuickOpenHandler } from './quick-open-view';
48
68
  import { BottomTabRenderer, LeftTabRenderer, RightTabRenderer } from './tabbar/renderer.view';
49
69
 
50
- // NOTE 左右侧面板的展开、折叠命令请使用组合命令 activity-bar.left.toggle,layout命令仅做折叠展开,不处理tab激活逻辑
51
- export const HIDE_LEFT_PANEL_COMMAND: Command = {
52
- id: 'main-layout.left-panel.hide',
53
- label: '%main-layout.left-panel.hide%',
54
- };
55
-
56
- export const WORKBENCH_ACTION_CLOSESIDECAR: Command = {
57
- id: 'workbench.action.closeSidebar',
58
- label: '%main-layout.sidebar.hide%',
59
- };
60
-
61
- export const SHOW_LEFT_PANEL_COMMAND: Command = {
62
- id: 'main-layout.left-panel.show',
63
- label: '%main-layout.left-panel.show%',
64
- };
65
- export const TOGGLE_LEFT_PANEL_COMMAND: MenuCommandDesc = {
66
- id: 'main-layout.left-panel.toggle',
67
- label: '%main-layout.left-panel.toggle%',
68
- };
69
- export const HIDE_RIGHT_PANEL_COMMAND: Command = {
70
- id: 'main-layout.right-panel.hide',
71
- label: '%main-layout.right-panel.hide%',
72
- };
73
- export const SHOW_RIGHT_PANEL_COMMAND: Command = {
74
- id: 'main-layout.right-panel.show',
75
- label: '%main-layout.right-panel.show%',
76
- };
77
- export const TOGGLE_RIGHT_PANEL_COMMAND: MenuCommandDesc = {
78
- id: 'main-layout.right-panel.toggle',
79
- label: '%main-layout.right-panel.toggle%',
80
- };
81
-
82
- export const HIDE_BOTTOM_PANEL_COMMAND: Command = {
83
- id: 'main-layout.bottom-panel.hide',
84
- label: '%main-layout.bottom-panel.hide%',
85
- };
86
-
87
- export const WORKBENCH_ACTION_CLOSEPANEL: Command = {
88
- id: 'workbench.action.closePanel',
89
- delegate: HIDE_BOTTOM_PANEL_COMMAND.id,
90
- };
91
-
92
- export const SHOW_BOTTOM_PANEL_COMMAND: Command = {
93
- id: 'main-layout.bottom-panel.show',
94
- label: '%main-layout.bottom-panel.show%',
95
- };
96
- export const TOGGLE_BOTTOM_PANEL_COMMAND: Command = {
97
- id: 'main-layout.bottom-panel.toggle',
98
- iconClass: getIcon('minus'),
99
- label: '%layout.tabbar.toggle%',
100
- };
101
- export const IS_VISIBLE_BOTTOM_PANEL_COMMAND: Command = {
102
- id: 'main-layout.bottom-panel.is-visible',
103
- };
104
- export const IS_VISIBLE_LEFT_PANEL_COMMAND: Command = {
105
- id: 'main-layout.left-panel.is-visible',
106
- };
107
- export const IS_VISIBLE_RIGHT_PANEL_COMMAND: Command = {
108
- id: 'main-layout.right-panel.is-visible',
109
- };
110
- export const EXPAND_BOTTOM_PANEL: Command = {
111
- id: 'main-layout.bottom-panel.expand',
112
- label: '%layout.tabbar.expand%',
113
- iconClass: getIcon('expand'),
114
- };
115
- export const RETRACT_BOTTOM_PANEL: Command = {
116
- id: 'main-layout.bottom-panel.retract',
117
- label: '%layout.tabbar.retract%',
118
- iconClass: getIcon('shrink'),
119
- };
120
-
121
70
  @Domain(
122
71
  CommandContribution,
123
72
  ClientAppContribution,
@@ -196,15 +145,20 @@ export class MainLayoutModuleContribution
196
145
  }
197
146
 
198
147
  registerComponent(registry: ComponentRegistry): void {
199
- registry.register(DROP_RIGHT_CONTAINER, [], {
200
- component: RightDropArea,
148
+ registry.register(DROP_EXTEND_VIEW_CONTAINER, [], {
149
+ component: ExtendViewDropArea,
150
+ hideTab: true,
151
+ containerId: DROP_EXTEND_VIEW_CONTAINER,
152
+ });
153
+ registry.register(DROP_PANEL_CONTAINER, [], {
154
+ component: PanelDropArea,
201
155
  hideTab: true,
202
- containerId: DROP_RIGHT_CONTAINER,
156
+ containerId: DROP_PANEL_CONTAINER,
203
157
  });
204
- registry.register(DROP_BOTTOM_CONTAINER, [], {
205
- component: BottomDropArea,
158
+ registry.register(DROP_VIEW_CONTAINER, [], {
159
+ component: ViewDropArea,
206
160
  hideTab: true,
207
- containerId: DROP_BOTTOM_CONTAINER,
161
+ containerId: DROP_VIEW_CONTAINER,
208
162
  });
209
163
  }
210
164
 
@@ -217,78 +171,75 @@ export class MainLayoutModuleContribution
217
171
  }
218
172
 
219
173
  registerRenderer(registry: SlotRendererRegistry) {
220
- registry.registerSlotRenderer(SlotLocation.right, RightTabRenderer);
221
- registry.registerSlotRenderer(SlotLocation.left, LeftTabRenderer);
222
- registry.registerSlotRenderer(SlotLocation.bottom, BottomTabRenderer);
223
- }
224
-
225
- registerCommands(commands: CommandRegistry): void {
226
- // @deprecated
227
- commands.registerCommand(HIDE_LEFT_PANEL_COMMAND, {
228
- execute: () => {
229
- this.mainLayoutService.toggleSlot(SlotLocation.left, false);
174
+ registry.registerSlotRenderer(SlotLocation.extendView, RightTabRenderer, {
175
+ isLatter: true,
176
+ supportedActions: {
177
+ accordion: true,
230
178
  },
231
179
  });
232
- // @deprecated
233
- commands.registerCommand(SHOW_LEFT_PANEL_COMMAND, {
234
- execute: (size?: number) => {
235
- this.mainLayoutService.toggleSlot(SlotLocation.left, true, size);
180
+ registry.registerSlotRenderer(SlotLocation.view, LeftTabRenderer, {
181
+ supportedActions: {
182
+ accordion: true,
236
183
  },
237
184
  });
238
- commands.registerCommand(TOGGLE_LEFT_PANEL_COMMAND, {
239
- execute: (show?: boolean, size?: number) => {
240
- this.mainLayoutService.toggleSlot(SlotLocation.left, show, size);
185
+ registry.registerSlotRenderer(SlotLocation.panel, BottomTabRenderer, {
186
+ isLatter: true,
187
+ supportedActions: {
188
+ expand: true,
189
+ toggle: true,
241
190
  },
242
191
  });
192
+ }
243
193
 
244
- // @deprecated
245
- commands.registerCommand(HIDE_RIGHT_PANEL_COMMAND, {
246
- execute: () => {
247
- this.mainLayoutService.toggleSlot(SlotLocation.right, false);
194
+ registerCommands(commands: CommandRegistry): void {
195
+ commands.registerCommand(TOGGLE_VIEW_COMMAND, {
196
+ execute: (show?: boolean, size?: number) => {
197
+ this.mainLayoutService.toggleSlot(SlotLocation.view, show, size);
248
198
  },
249
199
  });
250
- // @deprecated
251
- commands.registerCommand(SHOW_RIGHT_PANEL_COMMAND, {
252
- execute: (size?: number) => {
253
- this.mainLayoutService.toggleSlot(SlotLocation.right, true, size);
200
+ commands.registerCommand(TOGGLE_EXTEND_VIEW_COMMAND, {
201
+ execute: (show?: boolean, size?: number) => {
202
+ this.mainLayoutService.toggleSlot(SlotLocation.extendView, show, size);
254
203
  },
255
204
  });
256
- commands.registerCommand(TOGGLE_RIGHT_PANEL_COMMAND, {
205
+ commands.registerCommand(TOGGLE_PANEL_COMMAND, {
257
206
  execute: (show?: boolean, size?: number) => {
258
- this.mainLayoutService.toggleSlot(SlotLocation.right, show, size);
207
+ this.mainLayoutService.toggleSlot(SlotLocation.panel, show, size);
259
208
  },
260
209
  });
210
+ commands.registerCommand(IS_VISIBLE_VIEW_COMMAND, {
211
+ execute: () => this.mainLayoutService.isVisible(SlotLocation.view),
212
+ });
213
+ commands.registerCommand(IS_VISIBLE_EXTEND_VIEW_COMMAND, {
214
+ execute: () => this.mainLayoutService.isVisible(SlotLocation.extendView),
215
+ });
216
+ commands.registerCommand(IS_VISIBLE_PANEL_COMMAND, {
217
+ execute: () => this.mainLayoutService.isVisible(SlotLocation.panel),
218
+ });
219
+ // TODO: 下个版本废弃掉
220
+ commands.registerCommand(TOGGLE_LEFT_PANEL_COMMAND);
221
+ commands.registerCommand(TOGGLE_RIGHT_PANEL_COMMAND);
222
+ commands.registerCommand(TOGGLE_BOTTOM_PANEL_COMMAND);
223
+ commands.registerCommand(EXPAND_BOTTOM_PANEL);
224
+ commands.registerCommand(RETRACT_BOTTOM_PANEL);
225
+ commands.registerCommand(IS_VISIBLE_LEFT_PANEL_COMMAND);
226
+ commands.registerCommand(IS_VISIBLE_RIGHT_PANEL_COMMAND);
227
+ commands.registerCommand(IS_VISIBLE_BOTTOM_PANEL_COMMAND);
261
228
 
262
229
  commands.registerCommand(WORKBENCH_ACTION_CLOSESIDECAR, {
263
230
  execute: () =>
264
231
  Promise.all([
265
- this.mainLayoutService.toggleSlot(SlotLocation.left, false),
266
- this.mainLayoutService.toggleSlot(SlotLocation.right, false),
232
+ this.mainLayoutService.toggleSlot(SlotLocation.view, false),
233
+ this.mainLayoutService.toggleSlot(SlotLocation.extendView, false),
267
234
  ]),
268
235
  });
269
236
 
270
- commands.registerCommand(SHOW_BOTTOM_PANEL_COMMAND, {
237
+ commands.registerCommand(WORKBENCH_ACTION_CLOSEPANEL, {
271
238
  execute: () => {
272
- this.mainLayoutService.toggleSlot(SlotLocation.bottom, true);
239
+ this.mainLayoutService.toggleSlot(SlotLocation.panel, false);
273
240
  },
274
241
  });
275
242
 
276
- commands.registerCommand(HIDE_BOTTOM_PANEL_COMMAND, {
277
- execute: () => {
278
- this.mainLayoutService.toggleSlot(SlotLocation.bottom, false);
279
- },
280
- });
281
- commands.registerCommand(WORKBENCH_ACTION_CLOSEPANEL);
282
- commands.registerCommand(IS_VISIBLE_BOTTOM_PANEL_COMMAND, {
283
- execute: () => this.mainLayoutService.getTabbarService('bottom').currentContainerId.get() !== '',
284
- });
285
- commands.registerCommand(IS_VISIBLE_LEFT_PANEL_COMMAND, {
286
- execute: () => this.mainLayoutService.isVisible(SlotLocation.left),
287
- });
288
- commands.registerCommand(IS_VISIBLE_RIGHT_PANEL_COMMAND, {
289
- execute: () => this.mainLayoutService.isVisible(SlotLocation.left),
290
- });
291
-
292
243
  commands.registerCommand(
293
244
  {
294
245
  id: 'view.outward.right-panel.hide',
@@ -359,14 +310,14 @@ export class MainLayoutModuleContribution
359
310
  });
360
311
 
361
312
  Object.entries({
362
- [SlotLocation.left]: [
313
+ [SlotLocation.view]: [
363
314
  EXPLORER_CONTAINER_ID,
364
315
  SEARCH_CONTAINER_ID,
365
316
  SCM_CONTAINER_ID,
366
317
  DEBUG_CONTAINER_ID,
367
318
  EXTENSION_CONTAINER_ID,
368
319
  ],
369
- [SlotLocation.bottom]: [
320
+ [SlotLocation.panel]: [
370
321
  MARKER_CONTAINER_ID,
371
322
  OUTPUT_CONTAINER_ID,
372
323
  DEBUG_CONSOLE_CONTAINER_ID,
@@ -396,24 +347,24 @@ export class MainLayoutModuleContribution
396
347
  });
397
348
 
398
349
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
399
- command: TOGGLE_LEFT_PANEL_COMMAND,
350
+ command: TOGGLE_VIEW_COMMAND,
400
351
  group: '5_panel',
401
352
  });
402
353
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
403
- command: TOGGLE_RIGHT_PANEL_COMMAND,
354
+ command: TOGGLE_EXTEND_VIEW_COMMAND,
404
355
  group: '5_panel',
405
356
  });
406
357
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
407
- command: TOGGLE_BOTTOM_PANEL_COMMAND as MenuCommandDesc,
358
+ command: TOGGLE_PANEL_COMMAND as MenuCommandDesc,
408
359
  group: '5_panel',
409
360
  });
410
361
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
411
- command: EXPAND_BOTTOM_PANEL as MenuCommandDesc,
362
+ command: EXPAND_PANEL_COMMAND as MenuCommandDesc,
412
363
  group: '5_panel',
413
364
  when: '!bottomFullExpanded',
414
365
  });
415
366
  menus.registerMenuItem(MenuId.MenubarViewMenu, {
416
- command: RETRACT_BOTTOM_PANEL as MenuCommandDesc,
367
+ command: RETRACT_PANEL_COMMAND as MenuCommandDesc,
417
368
  group: '5_panel',
418
369
  when: 'bottomFullExpanded',
419
370
  });
@@ -431,20 +382,24 @@ export class MainLayoutModuleContribution
431
382
  protected registerSideToggleKey() {
432
383
  this.keybindingRegistry.registerKeybinding({
433
384
  keybinding: 'ctrlcmd+b',
434
- command: TOGGLE_LEFT_PANEL_COMMAND.id,
385
+ command: TOGGLE_VIEW_COMMAND.id,
386
+ });
387
+ this.keybindingRegistry.registerKeybinding({
388
+ keybinding: 'ctrlcmd+alt+b',
389
+ command: TOGGLE_EXTEND_VIEW_COMMAND.id,
435
390
  });
436
391
  this.keybindingRegistry.registerKeybinding({
437
392
  keybinding: 'ctrlcmd+j',
438
- command: TOGGLE_BOTTOM_PANEL_COMMAND.id,
393
+ command: TOGGLE_PANEL_COMMAND.id,
439
394
  });
440
395
  this.keybindingRegistry.registerKeybinding({
441
396
  keybinding: 'ctrlcmd+shift+j',
442
- command: EXPAND_BOTTOM_PANEL.id,
397
+ command: EXPAND_PANEL_COMMAND.id,
443
398
  when: '!bottomFullExpanded',
444
399
  });
445
400
  this.keybindingRegistry.registerKeybinding({
446
401
  keybinding: 'ctrlcmd+shift+j',
447
- command: RETRACT_BOTTOM_PANEL.id,
402
+ command: RETRACT_PANEL_COMMAND.id,
448
403
  when: 'bottomFullExpanded',
449
404
  });
450
405
  }