Remove DOM component (#14328)

* Remove DOM component

* fix compile

* Remove enum type

* one more
This commit is contained in:
Charles Gagnon
2021-02-17 15:16:42 -08:00
committed by GitHub
parent 05f97411fa
commit d159a1eb50
11 changed files with 0 additions and 145 deletions

View File

@@ -228,13 +228,6 @@ class ModelBuilderImpl implements azdata.ModelBuilder {
return builder;
}
dom(): azdata.ComponentBuilder<azdata.DomComponent, azdata.DomProperties> {
let id = this.getNextComponentId();
let builder: ComponentBuilderImpl<azdata.DomComponent, azdata.DomProperties> = this.getComponentBuilder(new DomComponentWrapper(this._proxy, this._handle, id), id);
this._componentBuilders.set(id, builder);
return builder;
}
hyperlink(): azdata.ComponentBuilder<azdata.HyperlinkComponent, azdata.HyperlinkComponentProperties> {
let id = this.getNextComponentId();
let builder: ComponentBuilderImpl<azdata.HyperlinkComponent, azdata.HyperlinkComponentProperties> = this.getComponentBuilder(new HyperlinkComponentWrapper(this._proxy, this._handle, id), id);
@@ -1133,21 +1126,6 @@ class WebViewWrapper extends ComponentWrapper implements azdata.WebViewComponent
}
}
class DomComponentWrapper extends ComponentWrapper implements azdata.DomComponent {
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
super(proxy, handle, ModelComponentTypes.Dom, id);
this.properties = {};
}
public get html(): string {
return this.properties['html'];
}
public set html(html: string) {
this.setProperty('html', html);
}
}
class EditorWrapper extends ComponentWrapper implements azdata.EditorComponent {
constructor(proxy: MainThreadModelViewShape, handle: number, id: string) {
super(proxy, handle, ModelComponentTypes.Editor, id);

View File

@@ -170,7 +170,6 @@ export enum ModelComponentTypes {
FileBrowserTree,
Editor,
DiffEditor,
Dom,
Hyperlink,
Image,
RadioCardGroup,

View File

@@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------------------------
* 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!./media/dom';
import 'vs/css!./media/highlight';
import 'vs/css!./media/markdown';
import {
Component, Input, Inject, ChangeDetectorRef, forwardRef, ElementRef, OnDestroy
} from '@angular/core';
import * as azdata from 'azdata';
import * as DOM from 'vs/base/browser/dom';
import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
import { ILogService } from 'vs/platform/log/common/log';
@Component({
template: '',
selector: 'modelview-dom-component'
})
export default class DomComponent extends ComponentBase<azdata.DomProperties> implements IComponent, OnDestroy {
@Input() descriptor: IComponentDescriptor;
@Input() modelStore: IModelStore;
private _renderedHtml: string;
private _rootElement: HTMLElement;
private _bodyElement: HTMLElement;
constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(ILogService) logService: ILogService
) {
super(changeRef, el, logService);
}
ngAfterViewInit(): void {
this.createDomElement();
this._register(DOM.addDisposableListener(window, DOM.EventType.RESIZE, e => {
this.layout();
}));
this.baseInit();
}
ngOnDestroy(): void {
this.baseDestroy();
}
private createDomElement() {
this._rootElement = this._el.nativeElement;
this._bodyElement = DOM.$('.dom-body');
this._rootElement.append(this._bodyElement);
}
/// Dom Functions
private setHtml(): void {
if (this.html) {
this._renderedHtml = this.html;
this._bodyElement.innerHTML = this._renderedHtml;
}
}
/// IComponent implementation
public layout(): void {
super.layout();
const element = <HTMLElement>this._el.nativeElement;
element.style.width = this.getWidth();
element.style.height = this.getHeight();
}
public setLayout(layout: any): void {
// TODO allow configuring the look and feel
this.layout();
}
public setProperties(properties: { [key: string]: any; }): void {
super.setProperties(properties);
if (this.html !== this._renderedHtml) {
this.setHtml();
}
}
// CSS-bound properties
public get html(): string {
return this.getPropertyOrDefault<string>((props) => props.html, '');
}
public set html(newValue: string) {
this.setPropertyFromUI<string>((properties, html) => { properties.html = html; }, newValue);
}
}

View File

@@ -1,9 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
modelview-dom-component {
display: block;
-webkit-user-select: text;
}

View File

@@ -25,7 +25,6 @@ import LoadingComponent from 'sql/workbench/browser/modelComponents/loadingCompo
import FileBrowserTreeComponent from 'sql/workbench/browser/modelComponents/fileBrowserTree.component';
import EditorComponent from 'sql/workbench/browser/modelComponents/editor.component';
import DiffEditorComponent from 'sql/workbench/browser/modelComponents/diffeditor.component';
import DomComponent from 'sql/workbench/browser/modelComponents/dom.component';
import { registerComponentType } from 'sql/platform/dashboard/browser/modelComponentRegistry';
import HyperlinkComponent from 'sql/workbench/browser/modelComponents/hyperlink.component';
import SplitViewContainer from 'sql/workbench/browser/modelComponents/splitviewContainer.component';
@@ -107,9 +106,6 @@ registerComponentType(EDITOR_COMPONENT, ModelComponentTypes.Editor, EditorCompon
export const DIFF_EDITOR_COMPONENT = 'diff-editor-component';
registerComponentType(DIFF_EDITOR_COMPONENT, ModelComponentTypes.DiffEditor, DiffEditorComponent);
export const DOM_COMPONENT = 'dom-component';
registerComponentType(DOM_COMPONENT, ModelComponentTypes.Dom, DomComponent);
export const HYPERLINK_COMPONENT = 'hyperlink-component';
registerComponentType(HYPERLINK_COMPONENT, ModelComponentTypes.Hyperlink, HyperlinkComponent);