mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 01:25:38 -05:00
Angular Individual Service Injection - Decouple bootstrap service (#1457)
* change services to be individually injected into angular * messing around with injection * change angular bootstrapping to factory style * formatting * formatting * fix imports * fix build errors * fix testsw * fix tests * fix compile errors
This commit is contained in:
@@ -9,16 +9,19 @@ import {
|
||||
} from '@angular/core';
|
||||
|
||||
import * as sqlops from 'sqlops';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
|
||||
import { ComponentBase } from 'sql/parts/modelComponents/componentBase';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces';
|
||||
import { Dropdown, IDropdownOptions } from 'sql/base/browser/ui/editableDropdown/dropdown';
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
import { attachEditableDropdownStyler , attachSelectBoxStyler} from 'sql/common/theme/styler';
|
||||
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { attachListStyler } from 'vs/platform/theme/common/styler';
|
||||
|
||||
@Component({
|
||||
selector: 'dropdown',
|
||||
template: `
|
||||
@@ -38,8 +41,10 @@ export default class DropDownComponent extends ComponentBase implements ICompone
|
||||
@ViewChild('editableDropDown', { read: ElementRef }) private _editableDropDownContainer: ElementRef;
|
||||
@ViewChild('dropDown', { read: ElementRef }) private _dropDownContainer: ElementRef;
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _commonService: CommonServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef) {
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService
|
||||
) {
|
||||
super(changeRef);
|
||||
}
|
||||
|
||||
@@ -56,11 +61,11 @@ export default class DropDownComponent extends ComponentBase implements ICompone
|
||||
maxHeight: 125,
|
||||
ariaLabel: ''
|
||||
};
|
||||
this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this._commonService.contextViewService, this._commonService.themeService,
|
||||
this._editableDropdown = new Dropdown(this._editableDropDownContainer.nativeElement, this.contextViewService, this.themeService,
|
||||
dropdownOptions);
|
||||
|
||||
this._register(this._editableDropdown);
|
||||
this._register(attachEditableDropdownStyler(this._editableDropdown, this._commonService.themeService));
|
||||
this._register(attachEditableDropdownStyler(this._editableDropdown, this.themeService));
|
||||
this._register(this._editableDropdown.onValueChange(e => {
|
||||
if (this.editable) {
|
||||
this.value = this._editableDropdown.value;
|
||||
@@ -72,11 +77,11 @@ export default class DropDownComponent extends ComponentBase implements ICompone
|
||||
}));
|
||||
}
|
||||
if (this._dropDownContainer) {
|
||||
this._selectBox = new SelectBox(this.values || [], this.value, this._commonService.contextViewService, this._dropDownContainer.nativeElement);
|
||||
this._selectBox = new SelectBox(this.values || [], this.value, this.contextViewService, this._dropDownContainer.nativeElement);
|
||||
this._selectBox.render(this._dropDownContainer.nativeElement);
|
||||
this._register(this._selectBox);
|
||||
|
||||
this._register(attachSelectBoxStyler(this._selectBox, this._commonService.themeService));
|
||||
this._register(attachSelectBoxStyler(this._selectBox, this.themeService));
|
||||
this._register(this._selectBox.onDidSelect(e => {
|
||||
if (!this.editable) {
|
||||
this.value = this._selectBox.value;
|
||||
|
||||
Reference in New Issue
Block a user