@opensumi/ide-main-layout 3.7.2-next-1740450374.0 → 3.7.2-next-1741226843.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 (59) hide show
  1. package/lib/browser/accordion/accordion.service.d.ts +3 -3
  2. package/lib/browser/accordion/accordion.service.d.ts.map +1 -1
  3. package/lib/browser/accordion/accordion.service.js.map +1 -1
  4. package/lib/browser/accordion/section.view.d.ts +1 -1
  5. package/lib/browser/accordion/section.view.d.ts.map +1 -1
  6. package/lib/browser/accordion/section.view.js +1 -3
  7. package/lib/browser/accordion/section.view.js.map +1 -1
  8. package/lib/browser/accordion/titlebar.view.d.ts +0 -3
  9. package/lib/browser/accordion/titlebar.view.d.ts.map +1 -1
  10. package/lib/browser/accordion/titlebar.view.js +1 -12
  11. package/lib/browser/accordion/titlebar.view.js.map +1 -1
  12. package/lib/browser/default-config.d.ts.map +1 -1
  13. package/lib/browser/default-config.js +2 -9
  14. package/lib/browser/default-config.js.map +1 -1
  15. package/lib/browser/layout.service.d.ts +0 -6
  16. package/lib/browser/layout.service.d.ts.map +1 -1
  17. package/lib/browser/layout.service.js +12 -94
  18. package/lib/browser/layout.service.js.map +1 -1
  19. package/lib/browser/main-layout.contribution.d.ts +1 -2
  20. package/lib/browser/main-layout.contribution.d.ts.map +1 -1
  21. package/lib/browser/main-layout.contribution.js +1 -14
  22. package/lib/browser/main-layout.contribution.js.map +1 -1
  23. package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
  24. package/lib/browser/tabbar/bar.view.js +3 -8
  25. package/lib/browser/tabbar/bar.view.js.map +1 -1
  26. package/lib/browser/tabbar/panel.view.d.ts +0 -1
  27. package/lib/browser/tabbar/panel.view.d.ts.map +1 -1
  28. package/lib/browser/tabbar/panel.view.js +3 -4
  29. package/lib/browser/tabbar/panel.view.js.map +1 -1
  30. package/lib/browser/tabbar/tabbar.service.d.ts +1 -4
  31. package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
  32. package/lib/browser/tabbar/tabbar.service.js +0 -15
  33. package/lib/browser/tabbar/tabbar.service.js.map +1 -1
  34. package/lib/browser/tabbar-handler.d.ts +1 -1
  35. package/lib/browser/tabbar-handler.d.ts.map +1 -1
  36. package/lib/browser/tabbar-handler.js.map +1 -1
  37. package/lib/common/main-layout.definition.d.ts +0 -6
  38. package/lib/common/main-layout.definition.d.ts.map +1 -1
  39. package/lib/common/main-layout.definition.js +1 -3
  40. package/lib/common/main-layout.definition.js.map +1 -1
  41. package/package.json +8 -8
  42. package/src/browser/accordion/accordion.service.ts +2 -2
  43. package/src/browser/accordion/section.view.tsx +2 -4
  44. package/src/browser/accordion/titlebar.view.tsx +2 -30
  45. package/src/browser/default-config.ts +2 -10
  46. package/src/browser/layout.service.ts +14 -107
  47. package/src/browser/main-layout.contribution.ts +2 -24
  48. package/src/browser/tabbar/bar.view.tsx +2 -9
  49. package/src/browser/tabbar/panel.view.tsx +2 -7
  50. package/src/browser/tabbar/tabbar.service.ts +0 -18
  51. package/src/browser/tabbar-handler.ts +1 -1
  52. package/src/common/main-layout.definition.ts +0 -7
  53. package/lib/browser/drop-area/drop-area.d.ts +0 -4
  54. package/lib/browser/drop-area/drop-area.d.ts.map +0 -1
  55. package/lib/browser/drop-area/drop-area.js +0 -25
  56. package/lib/browser/drop-area/drop-area.js.map +0 -1
  57. package/lib/browser/drop-area/styles.module.less +0 -7
  58. package/src/browser/drop-area/drop-area.tsx +0 -40
  59. package/src/browser/drop-area/styles.module.less +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-main-layout",
3
- "version": "3.7.2-next-1740450374.0",
3
+ "version": "3.7.2-next-1741226843.0",
4
4
  "description": "@opensumi/ide-main-layout",
5
5
  "files": [
6
6
  "lib",
@@ -18,14 +18,14 @@
18
18
  "url": "git@github.com:opensumi/core.git"
19
19
  },
20
20
  "dependencies": {
21
- "@opensumi/ide-components": "3.7.2-next-1740450374.0",
22
- "@opensumi/ide-core-browser": "3.7.2-next-1740450374.0",
23
- "@opensumi/ide-core-common": "3.7.2-next-1740450374.0",
24
- "@opensumi/ide-theme": "3.7.2-next-1740450374.0"
21
+ "@opensumi/ide-components": "3.7.2-next-1741226843.0",
22
+ "@opensumi/ide-core-browser": "3.7.2-next-1741226843.0",
23
+ "@opensumi/ide-core-common": "3.7.2-next-1741226843.0",
24
+ "@opensumi/ide-theme": "3.7.2-next-1741226843.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@opensumi/ide-dev-tool": "3.7.2-next-1740450374.0",
28
- "@opensumi/ide-monaco": "3.7.2-next-1740450374.0"
27
+ "@opensumi/ide-dev-tool": "3.7.2-next-1741226843.0",
28
+ "@opensumi/ide-monaco": "3.7.2-next-1741226843.0"
29
29
  },
30
- "gitHead": "12458460da12fc6e96c4942034c7012b2381990c"
30
+ "gitHead": "4abde3a575df8a7ce66b2977604b054f8a512af1"
31
31
  }
@@ -57,7 +57,7 @@ export interface SectionState {
57
57
  interface AccordionViewChangeEvent {
58
58
  id: string;
59
59
  title?: string;
60
- description?: string | React.ReactNode;
60
+ description?: string;
61
61
  message?: string;
62
62
  badge?: string | ViewBadge | undefined;
63
63
  }
@@ -198,7 +198,7 @@ export class AccordionService extends WithEventBus {
198
198
  }
199
199
  }
200
200
 
201
- updateViewDesciption(viewId: string, desc: string | React.ReactNode) {
201
+ updateViewDesciption(viewId: string, desc: string) {
202
202
  const view = this.views.find((view) => view.id === viewId);
203
203
  if (view) {
204
204
  view.description = desc;
@@ -26,7 +26,7 @@ export interface CollapsePanelProps extends React.PropsWithChildren<any> {
26
26
  // Header Title
27
27
  header: string;
28
28
  // Header Description
29
- description?: string | React.ReactNode;
29
+ description?: string;
30
30
  // Panel Message
31
31
  message?: string;
32
32
  // Header Size
@@ -185,9 +185,7 @@ export const AccordionSection = ({
185
185
  </div>
186
186
  {metadata.description && (
187
187
  <div className={styles.section_description} style={{ lineHeight: headerSize + 'px' }}>
188
- {typeof metadata.description === 'string'
189
- ? transformLabelWithCodicon(metadata.description, {}, iconService.fromString.bind(iconService))
190
- : metadata.description}
188
+ {transformLabelWithCodicon(metadata.description, {}, iconService.fromString.bind(iconService))}
191
189
  </div>
192
190
  )}
193
191
  {metadata.badge && (
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { useDesignStyles, useInjectable } from '@opensumi/ide-core-browser';
4
-
5
- import { TabbarService, TabbarServiceFactory } from '../tabbar/tabbar.service';
3
+ import { useDesignStyles } from '@opensumi/ide-core-browser';
6
4
 
7
5
  import styles from './styles.module.less';
8
6
 
@@ -10,37 +8,11 @@ export const TitleBar: React.FC<{
10
8
  title: string;
11
9
  menubar?: React.ReactNode;
12
10
  height?: number;
13
- draggable?: boolean;
14
- side?: string;
15
- containerId?: string;
16
11
  }> = React.memo((props) => {
17
12
  const styles_titlebar = useDesignStyles(styles.titlebar, 'titlebar');
18
- const tabbarService: TabbarService = useInjectable(TabbarServiceFactory)(props.side);
19
-
20
- const handleDragStart = React.useCallback(
21
- (e: React.DragEvent) => {
22
- if (props.containerId && props.side) {
23
- tabbarService.handleDragStart(e, props.containerId);
24
- }
25
- },
26
- [props.containerId, props.side, tabbarService],
27
- );
28
-
29
- const handleDragEnd = React.useCallback(
30
- (e: React.DragEvent) => {
31
- tabbarService.handleDragEnd(e);
32
- },
33
- [tabbarService],
34
- );
35
-
36
13
  return (
37
14
  <div className={styles_titlebar} style={{ height: props.height }}>
38
- {!props.draggable && <h1>{props.title}</h1>}
39
- {!!props.draggable && (
40
- <h1 draggable style={{ cursor: 'pointer' }} onDragStart={handleDragStart} onDragEnd={handleDragEnd}>
41
- {props.title}
42
- </h1>
43
- )}
15
+ <h1>{props.title}</h1>
44
16
  {props.menubar || null}
45
17
  </div>
46
18
  );
@@ -1,8 +1,6 @@
1
1
  /* istanbul ignore file */
2
2
  import { LayoutConfig, SlotLocation } from '@opensumi/ide-core-browser';
3
3
 
4
- import { DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER } from '../common';
5
-
6
4
  export const defaultConfig: LayoutConfig = {
7
5
  [SlotLocation.top]: {
8
6
  modules: ['@opensumi/ide-menu-bar'],
@@ -21,19 +19,13 @@ export const defaultConfig: LayoutConfig = {
21
19
  ],
22
20
  },
23
21
  [SlotLocation.right]: {
24
- modules: [DROP_RIGHT_CONTAINER],
22
+ modules: [],
25
23
  },
26
24
  [SlotLocation.main]: {
27
25
  modules: ['@opensumi/ide-editor'],
28
26
  },
29
27
  [SlotLocation.bottom]: {
30
- modules: [
31
- DROP_BOTTOM_CONTAINER,
32
- '@opensumi/ide-terminal-next',
33
- '@opensumi/ide-output',
34
- 'debug-console',
35
- '@opensumi/ide-markers',
36
- ],
28
+ modules: ['@opensumi/ide-terminal-next', '@opensumi/ide-output', 'debug-console', '@opensumi/ide-markers'],
37
29
  },
38
30
  [SlotLocation.statusBar]: {
39
31
  modules: ['@opensumi/ide-status-bar'],
@@ -32,8 +32,6 @@ import { Deferred, getDebugLogger, isUndefined } from '@opensumi/ide-core-common
32
32
  import { ThemeChangedEvent } from '@opensumi/ide-theme';
33
33
 
34
34
  import {
35
- DROP_BOTTOM_CONTAINER,
36
- DROP_RIGHT_CONTAINER,
37
35
  IMainLayoutService,
38
36
  MainLayoutContribution,
39
37
  SUPPORT_ACCORDION_LOCATION,
@@ -203,7 +201,7 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
203
201
  /**
204
202
  * ContainerId 存在三种值类型,对应的处理模式如下:
205
203
  * 1. undefined: 采用首个注册的容器作为当前 containerId
206
- * 2. string: 非 drop container 直接使用该 containerId 作为当前 containerId
204
+ * 2. string: 直接使用该 containerId 作为当前 containerId
207
205
  * 3. '': 直接清空当前 containerId,不展开相应的 viewContainer
208
206
  */
209
207
  if (isUndefined(currentId)) {
@@ -213,93 +211,19 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
213
211
  } else {
214
212
  service.updateCurrentContainerId(defaultContainer);
215
213
  }
216
- } else if (currentId && !this.isDropContainer(currentId)) {
214
+ } else if (currentId) {
217
215
  if (service.containersMap.has(currentId)) {
218
216
  service.updateCurrentContainerId(currentId);
219
217
  } 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
- }
218
+ service.updateCurrentContainerId(defaultContainer);
219
+ // 等待后续新容器注册时,更新当前的 containerId
220
+ service.updateNextContainerId(currentId);
229
221
  }
230
- } else if (currentId === '' || this.isDropContainer(currentId)) {
222
+ } else if (currentId === '') {
231
223
  service.updateCurrentContainerId('');
232
224
  }
233
225
  };
234
226
 
235
- findTabbarServiceByContainerId(containerId: string): TabbarService | undefined {
236
- let tabbarService: undefined | TabbarService;
237
- for (const value of this.tabbarServices.values()) {
238
- if (value.containersMap.has(containerId)) {
239
- tabbarService = value;
240
- break;
241
- }
242
- }
243
-
244
- return tabbarService;
245
- }
246
-
247
- moveContainerTo(containerId: string, to: string): void {
248
- const fromTabbar = this.findTabbarServiceByContainerId(containerId);
249
-
250
- if (!fromTabbar) {
251
- this.logger.error(`cannot find container: ${containerId}`);
252
- return;
253
- }
254
- const container = fromTabbar.getContainer(containerId);
255
- if (!container) {
256
- this.logger.error(`cannot find container: ${containerId}`);
257
- return;
258
- }
259
- if (!container.options?.draggable) {
260
- this.logger.warn(`container: ${containerId} is not draggable`);
261
- return;
262
- }
263
-
264
- const toTabbar = this.getTabbarService(to);
265
-
266
- fromTabbar.removeContainer(containerId);
267
-
268
- if (!fromTabbar.visibleContainers.length || fromTabbar.currentContainerId.get() === containerId) {
269
- this.toggleSlot(fromTabbar.location, false);
270
- }
271
- toTabbar.dynamicAddContainer(containerId, container);
272
- const newHandler = this.injector.get(TabBarHandler, [containerId, this.getTabbarService(toTabbar.location)]);
273
- this.handleMap.set(containerId, newHandler!);
274
- }
275
-
276
- showDropAreaForContainer(containerId: string): void {
277
- const tabbarService = this.findTabbarServiceByContainerId(containerId);
278
- const bottomService = this.tabbarServices.get('bottom');
279
- const rightService = this.tabbarServices.get('right');
280
- if (!tabbarService) {
281
- this.logger.error(`cannot find container: ${containerId}`);
282
- return;
283
- }
284
- if (tabbarService?.location === 'right') {
285
- bottomService?.updateCurrentContainerId(DROP_BOTTOM_CONTAINER);
286
- }
287
- if (tabbarService?.location === 'bottom') {
288
- rightService?.updateCurrentContainerId(DROP_RIGHT_CONTAINER);
289
- }
290
- }
291
-
292
- 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
- }
301
- }
302
-
303
227
  isVisible(location: string) {
304
228
  const tabbarService = this.getTabbarService(location);
305
229
  return !!tabbarService.currentContainerId.get();
@@ -321,13 +245,18 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
321
245
  return;
322
246
  }
323
247
  if (show === true) {
324
- // 不允许通过该api展示drop面板
325
- tabbarService.updateCurrentContainerId(this.findNonDropContainerId(tabbarService));
248
+ tabbarService.updateCurrentContainerId(
249
+ tabbarService.currentContainerId.get() ||
250
+ tabbarService.previousContainerId ||
251
+ tabbarService.containersMap.keys().next().value!,
252
+ );
326
253
  } else if (show === false) {
327
254
  tabbarService.updateCurrentContainerId('');
328
255
  } else {
329
256
  tabbarService.updateCurrentContainerId(
330
- tabbarService.currentContainerId.get() ? '' : this.findNonDropContainerId(tabbarService),
257
+ tabbarService.currentContainerId.get()
258
+ ? ''
259
+ : tabbarService.previousContainerId || tabbarService.containersMap.keys().next().value!,
331
260
  );
332
261
  }
333
262
  if (tabbarService.currentContainerId.get() && size) {
@@ -335,28 +264,6 @@ export class LayoutService extends WithEventBus implements IMainLayoutService {
335
264
  }
336
265
  }
337
266
 
338
- private isDropContainer(containerId: string): boolean {
339
- return [DROP_BOTTOM_CONTAINER, DROP_RIGHT_CONTAINER].includes(containerId);
340
- }
341
-
342
- private findNonDropContainerId(tabbarService: TabbarService): string {
343
- const currentContainerId = tabbarService.currentContainerId.get();
344
- if (currentContainerId && !this.isDropContainer(currentContainerId)) {
345
- return currentContainerId;
346
- }
347
- if (tabbarService.previousContainerId && !this.isDropContainer(tabbarService.previousContainerId)) {
348
- return tabbarService.previousContainerId;
349
- }
350
-
351
- for (const key of tabbarService.containersMap.keys()) {
352
- if (!this.isDropContainer(key)) {
353
- return key;
354
- }
355
- }
356
-
357
- return '';
358
- }
359
-
360
267
  getTabbarService(location: string) {
361
268
  const service = this.tabbarServices.get(location) || this.injector.get(TabbarService, [location]);
362
269
  if (!this.tabbarServices.get(location)) {
@@ -41,9 +41,8 @@ import {
41
41
  import { ContributionProvider, Domain, IEventBus, WithEventBus, localize } from '@opensumi/ide-core-common';
42
42
  import { Command, 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 { IMainLayoutService } from '../common';
45
45
 
46
- import { BottomDropArea, RightDropArea } from './drop-area/drop-area';
47
46
  import { ViewQuickOpenHandler } from './quick-open-view';
48
47
  import { BottomTabRenderer, LeftTabRenderer, RightTabRenderer } from './tabbar/renderer.view';
49
48
 
@@ -118,14 +117,7 @@ export const RETRACT_BOTTOM_PANEL: Command = {
118
117
  iconClass: getIcon('shrink'),
119
118
  };
120
119
 
121
- @Domain(
122
- CommandContribution,
123
- ClientAppContribution,
124
- SlotRendererContribution,
125
- MenuContribution,
126
- QuickOpenContribution,
127
- ComponentContribution,
128
- )
120
+ @Domain(CommandContribution, ClientAppContribution, SlotRendererContribution, MenuContribution, QuickOpenContribution)
129
121
  export class MainLayoutModuleContribution
130
122
  extends WithEventBus
131
123
  implements
@@ -133,7 +125,6 @@ export class MainLayoutModuleContribution
133
125
  ClientAppContribution,
134
126
  SlotRendererContribution,
135
127
  MenuContribution,
136
- ComponentContribution,
137
128
  QuickOpenContribution
138
129
  {
139
130
  @Autowired(IMainLayoutService)
@@ -195,19 +186,6 @@ export class MainLayoutModuleContribution
195
186
  }
196
187
  }
197
188
 
198
- registerComponent(registry: ComponentRegistry): void {
199
- registry.register(DROP_RIGHT_CONTAINER, [], {
200
- component: RightDropArea,
201
- hideTab: true,
202
- containerId: DROP_RIGHT_CONTAINER,
203
- });
204
- registry.register(DROP_BOTTOM_CONTAINER, [], {
205
- component: BottomDropArea,
206
- hideTab: true,
207
- containerId: DROP_BOTTOM_CONTAINER,
208
- });
209
- }
210
-
211
189
  async onStart() {
212
190
  this.registerSideToggleKey();
213
191
  }
@@ -125,15 +125,11 @@ export const TabbarViewBase: React.FC<ITabbarViewProps> = (props) => {
125
125
  });
126
126
 
127
127
  const renderContainers = React.useCallback(
128
- (component: ComponentRegistryInfo, tabbarService: TabbarService, currentContainerId?: string, side?: string) => {
128
+ (component: ComponentRegistryInfo, tabbarService: TabbarService, currentContainerId?: string) => {
129
129
  const containerId = component.options?.containerId;
130
130
  if (!containerId) {
131
131
  return null;
132
132
  }
133
- if (side && component.options?.hideLocationTab?.includes(side)) {
134
- return null;
135
- }
136
-
137
133
  tabbarService.updateTabInMoreKey(containerId, false);
138
134
  let ref: HTMLLIElement | null;
139
135
  return (
@@ -172,9 +168,6 @@ export const TabbarViewBase: React.FC<ITabbarViewProps> = (props) => {
172
168
  }
173
169
  tabbarService.handleDrop(e, containerId);
174
170
  }}
175
- onDragEnd={(e) => {
176
- tabbarService.handleDragEnd(e);
177
- }}
178
171
  key={containerId}
179
172
  id={containerId}
180
173
  onContextMenu={(e) => tabbarService.handleContextMenu(e, containerId)}
@@ -193,7 +186,7 @@ export const TabbarViewBase: React.FC<ITabbarViewProps> = (props) => {
193
186
  return (
194
187
  <div className={cls([styles_tab_bar, className])}>
195
188
  <div className={styles_bar_content} style={{ flexDirection: Layout.getTabbarDirection(direction) }}>
196
- {visibleContainers.map((component) => renderContainers(component, tabbarService, currentContainerId, side))}
189
+ {visibleContainers.map((component) => renderContainers(component, tabbarService, currentContainerId))}
197
190
  {renderOtherVisibleContainers({ props, renderContainers })}
198
191
  {hideContainers.length ? (
199
192
  <li
@@ -100,13 +100,12 @@ export const ContainerView: React.FC<{
100
100
  renderContainerWrap?: React.FC<{
101
101
  children: React.ReactNode;
102
102
  }>;
103
- customTitleBar?: React.ReactNode;
104
103
  className?: string;
105
- }> = ({ component, titleMenu, side, renderContainerWrap, className, customTitleBar }) => {
104
+ }> = ({ component, titleMenu, side, renderContainerWrap, className }) => {
106
105
  const ref = React.useRef<HTMLElement | null>();
107
106
  const containerRef = React.useRef<HTMLDivElement | null>(null);
108
107
  const appConfig = useInjectable<AppConfig>(AppConfig);
109
- const { title, titleComponent, component: CustomComponent, containerId, draggable } = component.options || {};
108
+ const { title, titleComponent, component: CustomComponent, containerId } = component.options || {};
110
109
  const injector: Injector = useInjectable(INJECTOR_TOKEN);
111
110
  const layoutViewSize = useInjectable<LayoutViewSizeConfig>(LayoutViewSizeConfig);
112
111
 
@@ -141,15 +140,11 @@ export const ContainerView: React.FC<{
141
140
 
142
141
  return (
143
142
  <div ref={containerRef} className={cls(styles.view_container, className)}>
144
- {!!customTitleBar && customTitleBar}
145
143
  {!CustomComponent && (
146
144
  <div onContextMenu={handleContextMenu} className={styles.panel_titlebar}>
147
145
  {!title ? null : (
148
146
  <TitleBar
149
- containerId={containerId}
150
- side={side}
151
147
  title={title}
152
- draggable={draggable}
153
148
  height={layoutViewSize.panelTitleBarHeight}
154
149
  menubar={<InlineActionBar menus={titleMenu} />}
155
150
  />
@@ -664,7 +664,6 @@ export class TabbarService extends WithEventBus {
664
664
  // drag & drop
665
665
  handleDragStart(e: React.DragEvent, containerId: string) {
666
666
  e.dataTransfer.setData('containerId', containerId);
667
- this.layoutService.showDropAreaForContainer(containerId);
668
667
  }
669
668
 
670
669
  handleDrop(e: React.DragEvent, target: string) {
@@ -678,10 +677,6 @@ export class TabbarService extends WithEventBus {
678
677
  }
679
678
  }
680
679
 
681
- handleDragEnd(e: React.DragEvent) {
682
- this.layoutService.hideDropArea();
683
- }
684
-
685
680
  restoreState() {
686
681
  this.storedState = this.layoutState.getState(LAYOUT_STATE.getTabbarSpace(this.location), {});
687
682
  for (const containerId of this.state.keys()) {
@@ -696,19 +691,6 @@ export class TabbarService extends WithEventBus {
696
691
  });
697
692
  }
698
693
 
699
- removeContainer(containerId: string) {
700
- const disposable = this.disposableMap.get(containerId);
701
- disposable?.dispose();
702
- this.updateCurrentContainerId('');
703
- this.doChangeViewEmitter.fire();
704
- }
705
-
706
- dynamicAddContainer(containerId: string, options: ComponentRegistryInfo) {
707
- this.registerContainer(containerId, options);
708
- this.updateCurrentContainerId(containerId);
709
- this.doChangeViewEmitter.fire();
710
- }
711
-
712
694
  protected doInsertTab(containers: ComponentRegistryInfo[], sourceIndex: number, targetIndex: number) {
713
695
  const targetPriority = this.getContainerState(containers[targetIndex].options!.containerId).priority;
714
696
  const changePriority = (sourceIndex: number, targetIndex: number) => {
@@ -156,7 +156,7 @@ export class TabBarHandler {
156
156
  /**
157
157
  * 更新子视图的描述
158
158
  */
159
- updateViewDescription(viewId: string, desciption: string | React.ReactNode) {
159
+ updateViewDescription(viewId: string, desciption: string) {
160
160
  this.accordionService.updateViewDesciption(viewId, desciption);
161
161
  }
162
162
 
@@ -86,10 +86,6 @@ export interface IMainLayoutService {
86
86
  getExtraTopMenu(): IContextMenu;
87
87
  getExtraMenu(): IContextMenu;
88
88
  getAllAccordionService(): Map<string, AccordionService>;
89
- moveContainerTo(containerId: string, to: string): void;
90
- showDropAreaForContainer(containerId: string): void;
91
- hideDropArea(): void;
92
- findTabbarServiceByContainerId(containerId: string): TabbarService | undefined;
93
89
  }
94
90
 
95
91
  export const MainLayoutContribution = Symbol('MainLayoutContribution');
@@ -132,6 +128,3 @@ export class ViewCollapseChangedEvent extends BasicEvent<{
132
128
  }> {}
133
129
 
134
130
  export const SUPPORT_ACCORDION_LOCATION = new Set([SlotLocation.left, SlotLocation.right]);
135
-
136
- export const DROP_BOTTOM_CONTAINER = 'drop-bottom';
137
- export const DROP_RIGHT_CONTAINER = 'drop-right';
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const RightDropArea: () => React.JSX.Element;
3
- export declare const BottomDropArea: () => React.JSX.Element;
4
- //# sourceMappingURL=drop-area.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop-area.d.ts","sourceRoot":"","sources":["../../../src/browser/drop-area/drop-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqC1B,eAAO,MAAM,aAAa,yBAAsC,CAAC;AAEjE,eAAO,MAAM,cAAc,yBAAuC,CAAC"}
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BottomDropArea = exports.RightDropArea = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importDefault(require("react"));
6
- const ide_core_browser_1 = require("@opensumi/ide-core-browser");
7
- const common_1 = require("../../common");
8
- const styles_module_less_1 = tslib_1.__importDefault(require("./styles.module.less"));
9
- const DropArea = (props) => {
10
- const { location } = props;
11
- const layoutService = (0, ide_core_browser_1.useInjectable)(common_1.IMainLayoutService);
12
- const handleDrop = react_1.default.useCallback((e) => {
13
- var _a;
14
- const containerId = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData('containerId');
15
- layoutService.moveContainerTo(containerId, location);
16
- }, [layoutService, location]);
17
- return (react_1.default.createElement("div", { className: styles_module_less_1.default.drop_area, onDrop: handleDrop, onDragOver: (e) => {
18
- e.preventDefault();
19
- } }, (0, ide_core_browser_1.localize)('main-layout.drop-area.tip')));
20
- };
21
- const RightDropArea = () => react_1.default.createElement(DropArea, { location: 'right' });
22
- exports.RightDropArea = RightDropArea;
23
- const BottomDropArea = () => react_1.default.createElement(DropArea, { location: 'bottom' });
24
- exports.BottomDropArea = BottomDropArea;
25
- //# sourceMappingURL=drop-area.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drop-area.js","sourceRoot":"","sources":["../../../src/browser/drop-area/drop-area.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,iEAAqE;AAErE,yCAAkD;AAElD,sFAA0C;AAM1C,MAAM,QAAQ,GAA6B,CAAC,KAAK,EAAE,EAAE;IACnD,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC3B,MAAM,aAAa,GAAG,IAAA,gCAAa,EAAqB,2BAAkB,CAAC,CAAC;IAE5E,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAClC,CAAC,CAAkB,EAAE,EAAE;;QACrB,MAAM,WAAW,GAAG,MAAA,CAAC,CAAC,YAAY,0CAAE,OAAO,CAAC,aAAa,CAAC,CAAC;QAC3D,aAAa,CAAC,eAAe,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC,EACD,CAAC,aAAa,EAAE,QAAQ,CAAC,CAC1B,CAAC;IAEF,OAAO,CACL,uCACE,SAAS,EAAE,4BAAM,CAAC,SAAS,EAC3B,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE;YAChB,CAAC,CAAC,cAAc,EAAE,CAAC;QACrB,CAAC,IAEA,IAAA,2BAAQ,EAAC,2BAA2B,CAAC,CAClC,CACP,CAAC;AACJ,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,8BAAC,QAAQ,IAAC,QAAQ,EAAC,OAAO,GAAG,CAAC;AAApD,QAAA,aAAa,iBAAuC;AAE1D,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,8BAAC,QAAQ,IAAC,QAAQ,EAAC,QAAQ,GAAG,CAAC;AAAtD,QAAA,cAAc,kBAAwC"}
@@ -1,7 +0,0 @@
1
- .drop_area {
2
- width: 100%;
3
- height: 100%;
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- }
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
-
3
- import { localize, useInjectable } from '@opensumi/ide-core-browser';
4
-
5
- import { IMainLayoutService } from '../../common';
6
-
7
- import styles from './styles.module.less';
8
-
9
- interface IDropAreaProps {
10
- location: string;
11
- }
12
-
13
- const DropArea: React.FC<IDropAreaProps> = (props) => {
14
- const { location } = props;
15
- const layoutService = useInjectable<IMainLayoutService>(IMainLayoutService);
16
-
17
- const handleDrop = React.useCallback(
18
- (e: React.DragEvent) => {
19
- const containerId = e.dataTransfer?.getData('containerId');
20
- layoutService.moveContainerTo(containerId, location);
21
- },
22
- [layoutService, location],
23
- );
24
-
25
- return (
26
- <div
27
- className={styles.drop_area}
28
- onDrop={handleDrop}
29
- onDragOver={(e) => {
30
- e.preventDefault();
31
- }}
32
- >
33
- {localize('main-layout.drop-area.tip')}
34
- </div>
35
- );
36
- };
37
-
38
- export const RightDropArea = () => <DropArea location='right' />;
39
-
40
- export const BottomDropArea = () => <DropArea location='bottom' />;
@@ -1,7 +0,0 @@
1
- .drop_area {
2
- width: 100%;
3
- height: 100%;
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- }