mirror of
https://github.com/mathuo/dockview
synced 2025-07-06 10:06:02 +00:00
feat: api improvements
This commit is contained in:
parent
926272067a
commit
4806421ba5
@ -24,7 +24,6 @@ describe('component.api', () => {
|
||||
'onDidRemoveView',
|
||||
'panels',
|
||||
'focus',
|
||||
'resizeToFit',
|
||||
'toJSON',
|
||||
];
|
||||
|
||||
@ -56,7 +55,6 @@ describe('component.api', () => {
|
||||
'onDidRemoveView',
|
||||
'panels',
|
||||
'focus',
|
||||
'resizeToFit',
|
||||
'toJSON',
|
||||
];
|
||||
|
||||
@ -88,7 +86,6 @@ describe('component.api', () => {
|
||||
'onDidLayoutChange',
|
||||
'orientation',
|
||||
'focus',
|
||||
'resizeToFit',
|
||||
'toJSON',
|
||||
'onDidActiveGroupChange',
|
||||
'onDidAddGroup',
|
||||
@ -130,7 +127,6 @@ describe('component.api', () => {
|
||||
'activePanel',
|
||||
'focus',
|
||||
'closeAllGroups',
|
||||
'resizeToFit',
|
||||
'toJSON',
|
||||
'onDidActiveGroupChange',
|
||||
'onDidAddGroup',
|
||||
|
@ -41,9 +41,7 @@ export interface CommonApi<T = any> {
|
||||
readonly onDidLayoutFromJSON: Event<void>;
|
||||
focus(): void;
|
||||
layout(width: number, height: number): void;
|
||||
resizeToFit(): void;
|
||||
fromJSON(data: T): void;
|
||||
|
||||
toJSON(): T;
|
||||
}
|
||||
|
||||
@ -126,10 +124,6 @@ export class SplitviewApi implements CommonApi<SerializedSplitview> {
|
||||
return this.component.addPanel(options);
|
||||
}
|
||||
|
||||
resizeToFit(): void {
|
||||
this.component.resizeToFit();
|
||||
}
|
||||
|
||||
movePanel(from: number, to: number): void {
|
||||
this.component.movePanel(from, to);
|
||||
}
|
||||
@ -221,10 +215,6 @@ export class PaneviewApi implements CommonApi<SerializedPaneview> {
|
||||
return this.component.addPanel(options);
|
||||
}
|
||||
|
||||
resizeToFit(): void {
|
||||
this.component.resizeToFit();
|
||||
}
|
||||
|
||||
fromJSON(data: SerializedPaneview): void {
|
||||
this.component.fromJSON(data);
|
||||
}
|
||||
@ -316,10 +306,6 @@ export class GridviewApi implements CommonApi<SerializedGridview> {
|
||||
this.component.movePanel(panel, options);
|
||||
}
|
||||
|
||||
resizeToFit(): void {
|
||||
this.component.resizeToFit();
|
||||
}
|
||||
|
||||
getPanel(id: string): IGridviewPanel | undefined {
|
||||
return this.component.getPanel(id);
|
||||
}
|
||||
@ -476,10 +462,6 @@ export class DockviewApi implements CommonApi<SerializedDockview> {
|
||||
this.component.removeGroup(<GroupviewPanel>group);
|
||||
}
|
||||
|
||||
resizeToFit(): void {
|
||||
return this.component.resizeToFit();
|
||||
}
|
||||
|
||||
getGroup(id: string): IGroupviewPanel | undefined {
|
||||
return this.component.getPanel(id);
|
||||
}
|
||||
|
@ -62,7 +62,6 @@ export interface IBaseGrid<T extends IGridPanelView> {
|
||||
toJSON(): object;
|
||||
fromJSON(data: any): void;
|
||||
layout(width: number, height: number, force?: boolean): void;
|
||||
resizeToFit(): void;
|
||||
setVisible(panel: T, visible: boolean): void;
|
||||
isVisible(panel: T): boolean;
|
||||
}
|
||||
@ -299,18 +298,6 @@ export abstract class BaseGrid<T extends IGridPanelView>
|
||||
this.gridview.layout(width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the layout to fit the parent container
|
||||
*/
|
||||
public resizeToFit(): void {
|
||||
if (!this.element.parentElement) {
|
||||
return;
|
||||
}
|
||||
const { width, height } =
|
||||
this.element.parentElement.getBoundingClientRect();
|
||||
this.layout(width, height);
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
super.dispose();
|
||||
|
||||
|
@ -108,7 +108,6 @@ export interface IPaneviewComponent extends IDisposable {
|
||||
layout(width: number, height: number): void;
|
||||
toJSON(): SerializedPaneview;
|
||||
fromJSON(serializedPaneview: SerializedPaneview): void;
|
||||
resizeToFit(): void;
|
||||
focus(): void;
|
||||
removePanel(panel: IPaneviewPanel): void;
|
||||
getPanel(id: string): IPaneviewPanel | undefined;
|
||||
@ -316,18 +315,6 @@ export class PaneviewComponent
|
||||
this.paneview.layout(size, orthogonalSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the layout to fit the parent container
|
||||
*/
|
||||
resizeToFit(): void {
|
||||
if (!this.element.parentElement) {
|
||||
return;
|
||||
}
|
||||
const { width, height } =
|
||||
this.element.parentElement.getBoundingClientRect();
|
||||
this.layout(width, height);
|
||||
}
|
||||
|
||||
toJSON(): SerializedPaneview {
|
||||
const maximum = (value: number) =>
|
||||
value === Number.MAX_SAFE_INTEGER ||
|
||||
|
@ -68,7 +68,6 @@ export interface ISplitviewComponent extends IDisposable {
|
||||
onDidLayoutChange: Event<void>;
|
||||
toJSON(): SerializedSplitview;
|
||||
fromJSON(serializedSplitview: SerializedSplitview): void;
|
||||
resizeToFit(): void;
|
||||
focus(): void;
|
||||
getPanel(id: string): ISplitviewPanel | undefined;
|
||||
setActive(view: ISplitviewPanel, skipFocus?: boolean): void;
|
||||
@ -296,18 +295,6 @@ export class SplitviewComponent
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize the layout to fit the parent container
|
||||
*/
|
||||
resizeToFit(): void {
|
||||
if (!this.element.parentElement) {
|
||||
return;
|
||||
}
|
||||
const { width, height } =
|
||||
this.element.parentElement.getBoundingClientRect();
|
||||
this.layout(width, height);
|
||||
}
|
||||
|
||||
layout(width: number, height: number): void {
|
||||
const [size, orthogonalSize] =
|
||||
this.splitview.orientation === Orientation.HORIZONTAL
|
||||
|
Loading…
x
Reference in New Issue
Block a user