@opensumi/ide-main-layout 3.7.1-next-1739781685.0 → 3.7.1

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 (46) hide show
  1. package/lib/browser/accordion/titlebar.view.d.ts +0 -3
  2. package/lib/browser/accordion/titlebar.view.d.ts.map +1 -1
  3. package/lib/browser/accordion/titlebar.view.js +1 -12
  4. package/lib/browser/accordion/titlebar.view.js.map +1 -1
  5. package/lib/browser/default-config.d.ts.map +1 -1
  6. package/lib/browser/default-config.js +2 -9
  7. package/lib/browser/default-config.js.map +1 -1
  8. package/lib/browser/layout.service.d.ts +0 -6
  9. package/lib/browser/layout.service.d.ts.map +1 -1
  10. package/lib/browser/layout.service.js +12 -94
  11. package/lib/browser/layout.service.js.map +1 -1
  12. package/lib/browser/main-layout.contribution.d.ts +1 -2
  13. package/lib/browser/main-layout.contribution.d.ts.map +1 -1
  14. package/lib/browser/main-layout.contribution.js +1 -14
  15. package/lib/browser/main-layout.contribution.js.map +1 -1
  16. package/lib/browser/tabbar/bar.view.d.ts.map +1 -1
  17. package/lib/browser/tabbar/bar.view.js +3 -8
  18. package/lib/browser/tabbar/bar.view.js.map +1 -1
  19. package/lib/browser/tabbar/panel.view.d.ts +0 -1
  20. package/lib/browser/tabbar/panel.view.d.ts.map +1 -1
  21. package/lib/browser/tabbar/panel.view.js +3 -4
  22. package/lib/browser/tabbar/panel.view.js.map +1 -1
  23. package/lib/browser/tabbar/tabbar.service.d.ts +0 -3
  24. package/lib/browser/tabbar/tabbar.service.d.ts.map +1 -1
  25. package/lib/browser/tabbar/tabbar.service.js +0 -15
  26. package/lib/browser/tabbar/tabbar.service.js.map +1 -1
  27. package/lib/common/main-layout.definition.d.ts +0 -6
  28. package/lib/common/main-layout.definition.d.ts.map +1 -1
  29. package/lib/common/main-layout.definition.js +1 -3
  30. package/lib/common/main-layout.definition.js.map +1 -1
  31. package/package.json +8 -8
  32. package/src/browser/accordion/titlebar.view.tsx +2 -30
  33. package/src/browser/default-config.ts +2 -10
  34. package/src/browser/layout.service.ts +14 -107
  35. package/src/browser/main-layout.contribution.ts +2 -24
  36. package/src/browser/tabbar/bar.view.tsx +2 -9
  37. package/src/browser/tabbar/panel.view.tsx +2 -7
  38. package/src/browser/tabbar/tabbar.service.ts +0 -18
  39. package/src/common/main-layout.definition.ts +0 -7
  40. package/lib/browser/drop-area/drop-area.d.ts +0 -4
  41. package/lib/browser/drop-area/drop-area.d.ts.map +0 -1
  42. package/lib/browser/drop-area/drop-area.js +0 -25
  43. package/lib/browser/drop-area/drop-area.js.map +0 -1
  44. package/lib/browser/drop-area/styles.module.less +0 -7
  45. package/src/browser/drop-area/drop-area.tsx +0 -40
  46. package/src/browser/drop-area/styles.module.less +0 -7
@@ -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) => {
@@ -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
- }