mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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';
|
||||
|
||||
@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'
|
||||
})
|
||||
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 _minimumHeight: number;
|
||||
private _instancetiationService: IInstantiationService;
|
||||
protected _title: string;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@@ -152,6 +158,7 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
||||
}
|
||||
this._isAutoResizable = this.isAutoResizable;
|
||||
this._minimumHeight = this.minimumHeight;
|
||||
this._title = this.title;
|
||||
this.layout();
|
||||
this.validate();
|
||||
}
|
||||
@@ -212,4 +219,12 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
||||
public set editorUriRight(newValue: string) {
|
||||
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();
|
||||
basicView.orientation = orientation;
|
||||
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;
|
||||
return basicView;
|
||||
}
|
||||
@@ -111,19 +112,17 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
||||
this._splitViewHeight = this.convertSizeToNumber(layout.splitViewHeight);
|
||||
|
||||
if (this._componentWrappers) {
|
||||
let i : number = 0;
|
||||
this._componentWrappers.forEach(item => {
|
||||
var component = item.modelStore.getComponent(item.descriptor.id);
|
||||
item.modelStore.validate(component).then(value => {
|
||||
if (value === true) {
|
||||
let view = this.GetCorrespondingView(component, this._orientation);
|
||||
this._splitView.addView(view, Sizing.Split(i));
|
||||
this._splitView.addView(view, Sizing.Distribute);
|
||||
}
|
||||
else {
|
||||
console.log('Could not add views inside split view container');
|
||||
}
|
||||
});
|
||||
i++;
|
||||
});
|
||||
}
|
||||
this._splitView.layout(this._splitViewHeight);
|
||||
|
||||
Reference in New Issue
Block a user