remove builder references from some componnets (#4868)

This commit is contained in:
Anthony Dresser
2019-04-08 14:24:03 -07:00
committed by GitHub
parent 88161cc37d
commit ab54f7bb45
4 changed files with 26 additions and 33 deletions

View File

@@ -5,7 +5,6 @@
import * as DOM from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Builder } from 'sql/base/browser/builder';
import { EditorOptions } from 'vs/workbench/common/editor'; import { EditorOptions } from 'vs/workbench/common/editor';
import { getZoomLevel } from 'vs/base/browser/browser'; import { getZoomLevel } from 'vs/base/browser/browser';
import { Configuration } from 'vs/editor/browser/config/configuration'; import { Configuration } from 'vs/editor/browser/config/configuration';
@@ -123,4 +122,4 @@ export class EditDataResultsEditor extends BaseEditor {
params, params,
input); input);
} }
} }

View File

@@ -5,23 +5,17 @@
import 'vs/css!./flexContainer'; import 'vs/css!./flexContainer';
import { import {
Component, Input, Inject, ChangeDetectorRef, forwardRef, ComponentFactoryResolver, ChangeDetectorRef, ViewChildren, ElementRef, OnDestroy, OnInit, QueryList
ViewChild, ViewChildren, ElementRef, Injector, OnDestroy, OnInit, QueryList
} from '@angular/core'; } from '@angular/core';
import * as types from 'vs/base/common/types'; import * as types from 'vs/base/common/types';
import { IComponent, IComponentDescriptor, IModelStore, IComponentEventArgs, ComponentEventType } from 'sql/parts/modelComponents/interfaces'; import { IComponent, IComponentDescriptor, IModelStore, IComponentEventArgs, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost.directive'; import { Emitter } from 'vs/base/common/event';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
import { ModelComponentWrapper } from 'sql/parts/modelComponents/modelComponentWrapper.component'; import { ModelComponentWrapper } from 'sql/parts/modelComponents/modelComponentWrapper.component';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { Builder } from 'sql/base/browser/builder';
import { IdGenerator } from 'vs/base/common/idGenerator';
import { createCSSRule, removeCSSRulesContainingSelector } from 'vs/base/browser/dom';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
@@ -89,9 +83,10 @@ export abstract class ComponentBase extends Disposable implements IComponent, On
} }
public updateStyles() { public updateStyles() {
let element = new Builder(this._el.nativeElement); const element = (<HTMLElement>this._el.nativeElement);
this._CSSStyles = this.CSSStyles; for (const style in this.CSSStyles) {
element.style(this._CSSStyles); element.style[style] = this.CSSStyles[style];
}
} }
public setProperties(properties: { [key: string]: any; }): void { public setProperties(properties: { [key: string]: any; }): void {

View File

@@ -19,11 +19,10 @@ import { CopyAction, SaveImageAction, CreateInsightAction, IChartActionContext }
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar'; import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/interfaces'; import { ChartType } from 'sql/parts/dashboard/widgets/insights/views/charts/interfaces';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { Dimension, $, getContentHeight, getContentWidth } from 'vs/base/browser/dom'; import * as DOM from 'vs/base/browser/dom';
import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox'; import { SelectBox } from 'vs/base/browser/ui/selectBox/selectBox';
import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox'; import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
import { Builder } from 'sql/base/browser/builder';
import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle'; import { IDisposable, dispose, Disposable } from 'vs/base/common/lifecycle';
import { attachSelectBoxStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler'; import { attachSelectBoxStyler, attachInputBoxStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService'; import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -86,12 +85,12 @@ export class ChartView extends Disposable implements IPanelView {
@IInstantiationService private _instantiationService: IInstantiationService, @IInstantiationService private _instantiationService: IInstantiationService,
) { ) {
super(); super();
this.taskbarContainer = $('div.taskbar-container'); this.taskbarContainer = DOM.$('div.taskbar-container');
this.taskbar = new Taskbar(this.taskbarContainer); this.taskbar = new Taskbar(this.taskbarContainer);
this.optionsControl = $('div.options-container'); this.optionsControl = DOM.$('div.options-container');
let generalControls = $('div.general-controls'); const generalControls = DOM.$('div.general-controls');
this.optionsControl.appendChild(generalControls); this.optionsControl.appendChild(generalControls);
this.typeControls = $('div.type-controls'); this.typeControls = DOM.$('div.type-controls');
this.optionsControl.appendChild(this.typeControls); this.optionsControl.appendChild(this.typeControls);
this._createInsightAction = this._instantiationService.createInstance(CreateInsightAction); this._createInsightAction = this._instantiationService.createInstance(CreateInsightAction);
@@ -100,7 +99,7 @@ export class ChartView extends Disposable implements IPanelView {
this.taskbar.setContent([{ action: this._createInsightAction }]); this.taskbar.setContent([{ action: this._createInsightAction }]);
let self = this; const self = this;
this.options = new Proxy(this.options, { this.options = new Proxy(this.options, {
get: function (target, key, receiver) { get: function (target, key, receiver) {
return Reflect.get(target, key, receiver); return Reflect.get(target, key, receiver);
@@ -148,9 +147,9 @@ export class ChartView extends Disposable implements IPanelView {
render(container: HTMLElement): void { render(container: HTMLElement): void {
if (!this.container) { if (!this.container) {
this.container = $('div.chart-parent-container'); this.container = DOM.$('div.chart-parent-container');
this.insightContainer = $('div.insight-container'); this.insightContainer = DOM.$('div.insight-container');
this.chartingContainer = $('div.charting-container'); this.chartingContainer = DOM.$('div.charting-container');
this.container.appendChild(this.taskbarContainer); this.container.appendChild(this.taskbarContainer);
this.container.appendChild(this.chartingContainer); this.container.appendChild(this.chartingContainer);
this.chartingContainer.appendChild(this.insightContainer); this.chartingContainer.appendChild(this.insightContainer);
@@ -174,9 +173,9 @@ export class ChartView extends Disposable implements IPanelView {
this.shouldGraph(); this.shouldGraph();
} }
layout(dimension: Dimension): void { layout(dimension: DOM.Dimension): void {
if (this.insight) { if (this.insight) {
this.insight.layout(new Dimension(getContentWidth(this.insightContainer), getContentHeight(this.insightContainer))); this.insight.layout(new DOM.Dimension(DOM.getContentWidth(this.insightContainer), DOM.getContentHeight(this.insightContainer)));
} }
} }
@@ -215,7 +214,7 @@ export class ChartView extends Disposable implements IPanelView {
this.optionMap = { this.optionMap = {
'type': this.optionMap['type'] 'type': this.optionMap['type']
}; };
new Builder(this.typeControls).clearChildren(); DOM.clearNode(this.typeControls);
this.updateActionbar(); this.updateActionbar();
ChartOptions[this.options.type].map(o => { ChartOptions[this.options.type].map(o => {
@@ -234,9 +233,9 @@ export class ChartView extends Disposable implements IPanelView {
let option = ChartOptions[this.options.type].find(e => e.configEntry === key); let option = ChartOptions[this.options.type].find(e => e.configEntry === key);
if (option && option.if) { if (option && option.if) {
if (option.if(this.options)) { if (option.if(this.options)) {
new Builder(this.optionMap[key].element).show(); DOM.show(this.optionMap[key].element);
} else { } else {
new Builder(this.optionMap[key].element).hide(); DOM.hide(this.optionMap[key].element);
} }
} }
} }
@@ -257,9 +256,9 @@ export class ChartView extends Disposable implements IPanelView {
} }
private createOption(option: IChartOption, container: HTMLElement) { private createOption(option: IChartOption, container: HTMLElement) {
let label = $('div'); let label = DOM.$('div');
label.innerText = option.label; label.innerText = option.label;
let optionContainer = $('div.option-container'); let optionContainer = DOM.$('div.option-container');
optionContainer.appendChild(label); optionContainer.appendChild(label);
let setFunc: (val) => void; let setFunc: (val) => void;
let value = this.state ? this.state.options[option.configEntry] || option.default : option.default; let value = this.state ? this.state.options[option.configEntry] || option.default : option.default;

View File

@@ -2,13 +2,13 @@
* Copyright (c) Microsoft Corporation. All rights reserved. * Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information. * Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import 'vs/css!./countInsight'; import 'vs/css!./countInsight';
import { IInsight, InsightType } from './interfaces'; import { IInsight, InsightType } from './interfaces';
import { IInsightData } from 'sql/parts/dashboard/widgets/insights/interfaces'; import { IInsightData } from 'sql/parts/dashboard/widgets/insights/interfaces';
import { $ } from 'vs/base/browser/dom'; import { $, clearNode } from 'vs/base/browser/dom';
import { Builder } from 'sql/base/browser/builder';
export class CountInsight implements IInsight { export class CountInsight implements IInsight {
public options; public options;
@@ -25,7 +25,7 @@ export class CountInsight implements IInsight {
public layout() { } public layout() { }
set data(data: IInsightData) { set data(data: IInsightData) {
new Builder(this.countImage).empty(); clearNode(this.countImage);
for (let i = 0; i < data.columns.length; i++) { for (let i = 0; i < data.columns.length; i++) {
let container = $('div.count-label-container'); let container = $('div.count-label-container');