mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add title for DiffEditor and fix SplitViewContainer (#4961)
* add option to have diff editor title * fix component being undefined and splitter not showing
This commit is contained in:
@@ -28,7 +28,12 @@ import { TextDiffEditorModel} from 'vs/workbench/common/editor/textDiffEditorMod
|
|||||||
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
import { CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '',
|
template: `
|
||||||
|
<div *ngIf="_title">
|
||||||
|
<div style="width: 100%; height:100%; padding-left:3px !important; background: #F4F4F4; border: 1px solid #BFBDBD;">
|
||||||
|
{{_title}}
|
||||||
|
</div>
|
||||||
|
</div>`,
|
||||||
selector: 'modelview-diff-editor-component'
|
selector: 'modelview-diff-editor-component'
|
||||||
})
|
})
|
||||||
export default class DiffEditorComponent extends ComponentBase implements IComponent, OnDestroy {
|
export default class DiffEditorComponent extends ComponentBase implements IComponent, OnDestroy {
|
||||||
@@ -43,6 +48,7 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
|||||||
private _isAutoResizable: boolean;
|
private _isAutoResizable: boolean;
|
||||||
private _minimumHeight: number;
|
private _minimumHeight: number;
|
||||||
private _instancetiationService: IInstantiationService;
|
private _instancetiationService: IInstantiationService;
|
||||||
|
protected _title: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||||
@@ -152,6 +158,7 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
|||||||
}
|
}
|
||||||
this._isAutoResizable = this.isAutoResizable;
|
this._isAutoResizable = this.isAutoResizable;
|
||||||
this._minimumHeight = this.minimumHeight;
|
this._minimumHeight = this.minimumHeight;
|
||||||
|
this._title = this.title;
|
||||||
this.layout();
|
this.layout();
|
||||||
this.validate();
|
this.validate();
|
||||||
}
|
}
|
||||||
@@ -212,4 +219,12 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
|||||||
public set editorUriRight(newValue: string) {
|
public set editorUriRight(newValue: string) {
|
||||||
this.setPropertyFromUI<azdata.EditorProperties, string>((properties, editorUriRight) => { properties.editorUriRight = editorUriRight; }, newValue);
|
this.setPropertyFromUI<azdata.EditorProperties, string>((properties, editorUriRight) => { properties.editorUriRight = editorUriRight; }, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get title(): string {
|
||||||
|
return this.getPropertyOrDefault<azdata.EditorProperties, string>((props) => props.title, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set title(newValue: string) {
|
||||||
|
this.setPropertyFromUI<azdata.EditorProperties, string>((properties, title) => { properties.title = title; }, newValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,8 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
|||||||
let basicView: SplitPane = new SplitPane();
|
let basicView: SplitPane = new SplitPane();
|
||||||
basicView.orientation = orientation;
|
basicView.orientation = orientation;
|
||||||
basicView.element = c.getHtml(),
|
basicView.element = c.getHtml(),
|
||||||
basicView.minimumSize = orientation === Orientation.VERTICAL ? c.convertSizeToNumber(c.height) : c.convertSizeToNumber(c.width);
|
basicView.component = c;
|
||||||
|
basicView.minimumSize = 50;
|
||||||
basicView.maximumSize = Number.MAX_VALUE;
|
basicView.maximumSize = Number.MAX_VALUE;
|
||||||
return basicView;
|
return basicView;
|
||||||
}
|
}
|
||||||
@@ -111,19 +112,17 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
|||||||
this._splitViewHeight = this.convertSizeToNumber(layout.splitViewHeight);
|
this._splitViewHeight = this.convertSizeToNumber(layout.splitViewHeight);
|
||||||
|
|
||||||
if (this._componentWrappers) {
|
if (this._componentWrappers) {
|
||||||
let i : number = 0;
|
|
||||||
this._componentWrappers.forEach(item => {
|
this._componentWrappers.forEach(item => {
|
||||||
var component = item.modelStore.getComponent(item.descriptor.id);
|
var component = item.modelStore.getComponent(item.descriptor.id);
|
||||||
item.modelStore.validate(component).then(value => {
|
item.modelStore.validate(component).then(value => {
|
||||||
if (value === true) {
|
if (value === true) {
|
||||||
let view = this.GetCorrespondingView(component, this._orientation);
|
let view = this.GetCorrespondingView(component, this._orientation);
|
||||||
this._splitView.addView(view, Sizing.Split(i));
|
this._splitView.addView(view, Sizing.Distribute);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('Could not add views inside split view container');
|
console.log('Could not add views inside split view container');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
i++;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this._splitView.layout(this._splitViewHeight);
|
this._splitView.layout(this._splitViewHeight);
|
||||||
|
|||||||
Reference in New Issue
Block a user