mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -8,17 +8,26 @@ import { Component } from 'vs/workbench/common/component';
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { Dimension, size } from 'vs/base/browser/dom';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IDimension } from 'vs/platform/layout/browser/layoutService';
|
||||
import { ISerializableView, Orientation } from 'vs/base/browser/ui/grid/grid';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
|
||||
export interface IPartOptions {
|
||||
hasTitle?: boolean;
|
||||
borderWidth?: () => number;
|
||||
}
|
||||
|
||||
export interface ILayoutContentResult {
|
||||
titleSize: IDimension;
|
||||
contentSize: IDimension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parts are layed out in the workbench and have their own layout that
|
||||
* arranges an optional title and mandatory content area to show content.
|
||||
*/
|
||||
export abstract class Part extends Component {
|
||||
export abstract class Part extends Component implements ISerializableView {
|
||||
private parent: HTMLElement;
|
||||
private titleArea: HTMLElement | null;
|
||||
private contentArea: HTMLElement | null;
|
||||
@@ -28,9 +37,12 @@ export abstract class Part extends Component {
|
||||
id: string,
|
||||
private options: IPartOptions,
|
||||
themeService: IThemeService,
|
||||
storageService: IStorageService
|
||||
storageService: IStorageService,
|
||||
layoutService: IWorkbenchLayoutService
|
||||
) {
|
||||
super(id, themeService, storageService);
|
||||
|
||||
layoutService.registerPart(this);
|
||||
}
|
||||
|
||||
protected onThemeChange(theme: ITheme): void {
|
||||
@@ -41,18 +53,22 @@ export abstract class Part extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
updateStyles(): void {
|
||||
super.updateStyles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: Clients should not call this method, the workbench calls this
|
||||
* method. Calling it otherwise may result in unexpected behavior.
|
||||
*
|
||||
* Called to create title and content area of the part.
|
||||
*/
|
||||
create(parent: HTMLElement): void {
|
||||
create(parent: HTMLElement, options?: object): void {
|
||||
this.parent = parent;
|
||||
this.titleArea = this.createTitleArea(parent);
|
||||
this.contentArea = this.createContentArea(parent);
|
||||
this.titleArea = this.createTitleArea(parent, options);
|
||||
this.contentArea = this.createContentArea(parent, options);
|
||||
|
||||
this.partLayout = new PartLayout(this.parent, this.options, this.titleArea, this.contentArea);
|
||||
this.partLayout = new PartLayout(this.options, this.contentArea);
|
||||
|
||||
this.updateStyles();
|
||||
}
|
||||
@@ -67,7 +83,7 @@ export abstract class Part extends Component {
|
||||
/**
|
||||
* Subclasses override to provide a title area implementation.
|
||||
*/
|
||||
protected createTitleArea(parent: HTMLElement): HTMLElement | null {
|
||||
protected createTitleArea(parent: HTMLElement, options?: object): HTMLElement | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -81,7 +97,7 @@ export abstract class Part extends Component {
|
||||
/**
|
||||
* Subclasses override to provide a content area implementation.
|
||||
*/
|
||||
protected createContentArea(parent: HTMLElement): HTMLElement | null {
|
||||
protected createContentArea(parent: HTMLElement, options?: object): HTMLElement | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -95,22 +111,35 @@ export abstract class Part extends Component {
|
||||
/**
|
||||
* Layout title and content area in the given dimension.
|
||||
*/
|
||||
layout(dimension: Dimension): Dimension[] {
|
||||
return this.partLayout.layout(dimension);
|
||||
protected layoutContents(width: number, height: number): ILayoutContentResult {
|
||||
return this.partLayout.layout(width, height);
|
||||
}
|
||||
|
||||
//#region ISerializableView
|
||||
|
||||
private _onDidChange = this._register(new Emitter<{ width: number; height: number; }>());
|
||||
get onDidChange(): Event<{ width: number, height: number }> { return this._onDidChange.event; }
|
||||
|
||||
element: HTMLElement;
|
||||
|
||||
abstract minimumWidth: number;
|
||||
abstract maximumWidth: number;
|
||||
abstract minimumHeight: number;
|
||||
abstract maximumHeight: number;
|
||||
|
||||
abstract layout(width: number, height: number, orientation: Orientation): void;
|
||||
abstract toJSON(): object;
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
export class PartLayout {
|
||||
class PartLayout {
|
||||
|
||||
private static readonly TITLE_HEIGHT = 35;
|
||||
|
||||
constructor(container: HTMLElement, private options: IPartOptions, titleArea: HTMLElement | null, private contentArea: HTMLElement | null) { }
|
||||
constructor(private options: IPartOptions, private contentArea: HTMLElement | null) { }
|
||||
|
||||
layout(dimension: Dimension): Dimension[] {
|
||||
const { width, height } = dimension;
|
||||
|
||||
// Return the applied sizes to title and content
|
||||
const sizes: Dimension[] = [];
|
||||
layout(width: number, height: number): ILayoutContentResult {
|
||||
|
||||
// Title Size: Width (Fill), Height (Variable)
|
||||
let titleSize: Dimension;
|
||||
@@ -127,14 +156,11 @@ export class PartLayout {
|
||||
contentSize.width -= this.options.borderWidth(); // adjust for border size
|
||||
}
|
||||
|
||||
sizes.push(titleSize);
|
||||
sizes.push(contentSize);
|
||||
|
||||
// Content
|
||||
if (this.contentArea) {
|
||||
size(this.contentArea, contentSize.width, contentSize.height);
|
||||
}
|
||||
|
||||
return sizes;
|
||||
return { titleSize, contentSize };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user