Files
azuredatastudio/src/sql/workbench/parts/notebook/cellViews/placeholderCell.component.ts
Anthony Dresser ddd89fc52a Renable Strict TSLint (#5018)
* removes more builder references

* remove builder from profiler

* formatting

* fix profiler dailog

* remove builder from oatuhdialog

* remove the rest of builder references

* formatting

* add more strict null checks to base

* enable strict tslint rules

* fix formatting

* fix compile error

* fix the rest of the hygeny issues and add pipeline step

* fix pipeline files
2019-04-18 00:34:53 -07:00

86 lines
2.3 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./placeholder';
import { OnInit, Component, Input, Inject, forwardRef, ElementRef, ChangeDetectorRef, OnDestroy, ViewChild, SimpleChange, OnChanges } from '@angular/core';
import { CellView } from 'sql/workbench/parts/notebook/cellViews/interfaces';
import { ICellModel } from 'sql/workbench/parts/notebook/models/modelInterfaces';
import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel';
import { localize } from 'vs/nls';
import { CellType } from 'sql/workbench/parts/notebook/models/contracts';
export const PLACEHOLDER_SELECTOR: string = 'placeholder-cell-component';
@Component({
selector: PLACEHOLDER_SELECTOR,
templateUrl: decodeURI(require.toUrl('./placeholderCell.component.html'))
})
export class PlaceholderCellComponent extends CellView implements OnInit, OnChanges {
@Input() cellModel: ICellModel;
@Input() set model(value: NotebookModel) {
this._model = value;
}
private _model: NotebookModel;
constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
) {
super();
}
ngOnInit() {
if (this.cellModel) {
this._register(this.cellModel.onOutputsChanged(() => {
this._changeRef.detectChanges();
}));
}
}
ngOnChanges(changes: { [propKey: string]: SimpleChange }) {
}
get model(): NotebookModel {
return this._model;
}
get clickOn(): string {
return localize('clickOn', 'Click on');
}
get plusCode(): string {
return localize('plusCode', '+ Code');
}
get or(): string {
return localize('or', 'or');
}
get plusText(): string {
return localize('plusText', '+ Text');
}
get toAddCell(): string {
return localize('toAddCell', 'to add a code or text cell');
}
public addCell(cellType: string, event?: Event): void {
if (event) {
event.stopPropagation();
}
let type: CellType = <CellType>cellType;
if (!type) {
type = 'code';
}
this._model.addCell(<CellType>cellType);
}
public layout() {
}
}