Strict compile for sql/workbench/services/dialog (#12578)

* Strict compile for sql/workbench/services/dialog

* fix errors
This commit is contained in:
Charles Gagnon
2020-09-23 13:15:59 -07:00
committed by GitHub
parent e1235a7346
commit 4e07685588
8 changed files with 72 additions and 68 deletions

View File

@@ -26,11 +26,10 @@ import { InputBox } from 'sql/platform/browser/inputbox/inputBox.component';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/registry/common/platform';
import { IBootstrapParams, ISelector } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
import { startsWith } from 'vs/base/common/strings';
import { PanelModule } from 'sql/base/browser/ui/panel/panel.module';
import { PropertiesContainerModule } from 'sql/base/browser/ui/propertiesContainer/propertiesContainer.module';
export const DialogModule = (params, selector: string, instantiationService: IInstantiationService): any => {
export const DialogModule = (params: IBootstrapParams, selector: string, instantiationService: IInstantiationService): any => {
/* Model-backed components */
let extensionComponents = Registry.as<IComponentRegistry>(Extensions.ComponentContribution).getAllCtors();
@@ -73,7 +72,7 @@ export const DialogModule = (params, selector: string, instantiationService: IIn
}
ngDoBootstrap(appRef: ApplicationRef) {
let componentClass = startsWith(this.selector, WizardNavigation.SELECTOR) ? WizardNavigation : DialogContainer;
let componentClass = this.selector.startsWith(WizardNavigation.SELECTOR) ? WizardNavigation : DialogContainer;
const factoryWrapper: any = this._resolver.resolveComponentFactory<WizardNavigation | DialogContainer>(componentClass);
factoryWrapper.factory.selector = this.selector;
appRef.bootstrap(factoryWrapper);

View File

@@ -48,7 +48,7 @@ export class DialogContainer implements AfterViewInit {
public _dialogPane: DialogPane;
public modelViewId: string;
@ViewChild(ModelViewContent) private _modelViewContent: ModelViewContent;
@ViewChild(ModelViewContent) private _modelViewContent!: ModelViewContent;
constructor(
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,

View File

@@ -24,16 +24,16 @@ import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
import { localize } from 'vs/nls';
export class DialogPane extends Disposable implements IThemable {
private _tabbedPanel: TabbedPanel;
private _tabbedPanel: TabbedPanel | undefined;
private _moduleRefs: NgModuleRef<{}>[] = [];
// Validation
private _modelViewValidityMap = new Map<string, boolean>();
private _body: HTMLElement;
private _body!: HTMLElement;
private _selectedTabIndex: number = 0; //TODO: can be an option
private _onLayoutChange = new Emitter<LayoutRequestParams>();
private _selectedTabContent: string;
private _selectedTabContent: string = '';
public pageNumber?: number;
constructor(
@@ -68,11 +68,11 @@ export class DialogPane extends Disposable implements IThemable {
tabContainer.style.display = 'none';
this._body.appendChild(tabContainer);
this.initializeModelViewContainer(tabContainer, tab.content, tab);
this._tabbedPanel.onTabChange(e => {
tabContainer.style.height = (this.getTabDimension().height - this._tabbedPanel.headersize) + 'px';
this._tabbedPanel!.onTabChange(e => {
tabContainer.style.height = (this.getTabDimension().height - this._tabbedPanel!.headersize) + 'px';
this._onLayoutChange.fire({ modelViewId: tab.content });
});
this._tabbedPanel.pushTab({
this._tabbedPanel!.pushTab({
title: tab.title,
identifier: 'dialogPane.' + this.title + '.' + tabIndex,
view: {
@@ -130,7 +130,7 @@ export class DialogPane extends Disposable implements IThemable {
dialogPane: this
} as DialogComponentParams,
undefined,
(moduleRef) => {
(moduleRef: NgModuleRef<{}>) => {
return this._moduleRefs.push(moduleRef);
});
}
@@ -155,8 +155,8 @@ export class DialogPane extends Disposable implements IThemable {
* Called by the theme registry on theme change to style the component
*/
public style(styles: IModalDialogStyles): void {
this._body.style.backgroundColor = styles.dialogBodyBackground ? styles.dialogBodyBackground.toString() : undefined;
this._body.style.color = styles.dialogForeground ? styles.dialogForeground.toString() : undefined;
this._body.style.backgroundColor = styles.dialogBodyBackground ? styles.dialogBodyBackground.toString() : '';
this._body.style.color = styles.dialogForeground ? styles.dialogForeground.toString() : '';
}
private _setValidity(modelViewId: string, valid: boolean) {

View File

@@ -74,12 +74,10 @@ export class WizardModal extends Modal {
attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND });
}
if (this._wizard.customButtons) {
this._wizard.customButtons.forEach(button => {
let buttonElement = this.addDialogButton(button);
this.updateButtonElement(buttonElement, button);
});
}
this._wizard.customButtons.forEach(button => {
let buttonElement = this.addDialogButton(button);
this.updateButtonElement(buttonElement, button);
});
this._previousButton = this.addDialogButton(this._wizard.backButton, () => this.showPage(this._wizard.currentPage - 1));
this._nextButton = this.addDialogButton(this._wizard.nextButton, () => this.showPage(this._wizard.currentPage + 1, true, true), true, true);

View File

@@ -12,8 +12,8 @@ import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
export class WizardNavigationParams implements IBootstrapParams {
wizard: Wizard;
navigationHandler: (index: number) => void;
wizard!: Wizard;
navigationHandler!: (index: number) => void;
}
@Component({
@@ -39,7 +39,7 @@ export class WizardNavigation implements AfterViewInit {
private _onResize = new Emitter<void>();
public readonly onResize: Event<void> = this._onResize.event;
@ViewChild('container', { read: ElementRef }) private _container: ElementRef;
@ViewChild('container', { read: ElementRef }) private _container!: ElementRef;
constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(IBootstrapParams) private _params: WizardNavigationParams,
@@ -77,6 +77,9 @@ export class WizardNavigation implements AfterViewInit {
private style(): void {
let theme = this._themeService.getColorTheme();
let navigationBackgroundColor = theme.getColor(SIDE_BAR_BACKGROUND);
if (!navigationBackgroundColor) {
return;
}
if (theme.type === 'light') {
navigationBackgroundColor = navigationBackgroundColor.lighten(0.03);
} else if (theme.type === 'dark') {